Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
justinwritescode opened this issue Jan 6, 2023 · 0 comments · Fixed by #157
Labels
bug Something isn't working

Comments

@justinwritescode
Copy link

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

@justinwritescode justinwritescode added the bug Something isn't working label Jan 6, 2023
@kzu kzu closed this as completed in #157 Jan 10, 2023
@kzu kzu closed this as completed in c6e238d Jan 10, 2023
@devlooped devlooped locked and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant