Skip to content

Embedded resources with the same filename but different extensions will create collisions #156

@justinwritescode

Description

@justinwritescode

Describe the Bug

If I try to embed something like swaggerui.js and swaggerui.css in the same assembly, it will try to put them both in under the same parent class.

Steps to Reproduce

Embed swaggerui.js and swaggerui.css in the same assembly, which generates this

..snip
            /// <summary>
            /// => @"swaggerui/swaggerui.css"
            /// </summary>
            public static partial class swaggerui
            {
                public static byte[] GetBytes() => EmbeddedResource.GetBytes(@"swaggerui/swaggerui.css");
                public static Stream GetStream() => EmbeddedResource.GetStream(@"swaggerui/swaggerui.css");
            }
        }

And this:

...snip
        public static partial class swaggerui
        {
            /// <summary>
            /// => @"swaggerui/swaggerui.js"
            /// </summary>
            public static partial class swaggerui
            {
                public static byte[] GetBytes() => EmbeddedResource.GetBytes(@"swaggerui/swaggerui.js");
                public static Stream GetStream() => EmbeddedResource.GetStream(@"swaggerui/swaggerui.js");
            }
        }

...in the same namespace, which creates naming collisions

Expected Behavior

Perhaps make the class creation go all the way down to the extension like so:?

...snip
        public static partial class swaggerui
        {
            /// <summary>
            /// => @"swaggerui/swaggerui.css"
            /// </summary>
            public static partial class swaggerui
            {
                public static partial class css
                {
                    public static byte[] GetBytes() => EmbeddedResource.GetBytes(@"swaggerui/swaggerui.js");
                    public static Stream GetStream() => EmbeddedResource.GetStream(@"swaggerui/swaggerui.js");
                }
...snip
                /// <summary>
                /// => @"swaggerui/swaggerui.css"
                /// </summary>
                public static partial class js
                {
                    public static byte[] GetBytes() => EmbeddedResource.GetBytes(@"swaggerui/swaggerui.js");
                    public static Stream GetStream() => EmbeddedResource.GetStream(@"swaggerui/swaggerui.js");
                }
            }
        }

Exception with Stack Trace

swaggerui.swaggerui.js.g.cs(26,38): error CS0111: Type 'ThisAssembly.Resources.swaggerui.swaggerui' already defines a member called 'GetStream' with the same parameter types

Version Info

1.1.1

Additional Info

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions