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

Compilation fails when resource file is name Resources.resx #167

Closed
plfaucher opened this issue Jan 24, 2023 · 0 comments · Fixed by #161
Closed

Compilation fails when resource file is name Resources.resx #167

plfaucher opened this issue Jan 24, 2023 · 0 comments · Fixed by #161
Labels
bug Something isn't working

Comments

@plfaucher
Copy link

Describe the Bug

Compilation fails when resource file is name Resources.resx

Steps to Reproduce

Using ThisAssembly 1.1.3

We have a Resources.resx file, set as Embedded resource, and when updating from 1.0.10 to 1.1.3 we get this error at compile:

'Resources': member names cannot be the same as their enclosing type

This is the file generated by ThisAssembly

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     ThisAssembly.Resources: 1.1.3
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.IO;

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

Expected Behavior

I'd expect the version bump to work as it is a minor version.

Exception with Stack Trace

1>------ Rebuild All started: Project: REDACTED, Configuration: Debug Any CPU ------
1>C:\Users\redacted\Code\redacted\src\redacted\ThisAssembly.Resource\ThisAssembly.ResourcesGenerator\Resources.g.cs(21,37,21,46): error CS0542: 'Resources': member names cannot be the same as their enclosing type
1>Done building project "REDACTED.csproj" -- FAILED.

Version Info

We are currently on 1.0.10 and trying to upgrade to 1.1.3

Additional Info

@plfaucher plfaucher added the bug Something isn't working label Jan 24, 2023
viceroypenguin added a commit to viceroypenguin/ThisAssembly that referenced this issue Jan 24, 2023
@kzu kzu closed this as completed in #161 Jan 25, 2023
kzu pushed a commit that referenced this issue Jan 25, 2023
* Move Path Sanitizer code to common .cs file

* Update ThisAssembly.Resources to use common .cs file code

* Test Sanitization Code

* Fix more path name issues

Closes #167

* Handle rare corner case ("/0/0/abc.csv")
@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