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
Add ClassName property to ResxSourceGenerator #7226
base: main
Are you sure you want to change the base?
Conversation
@microsoft-github-policy-service agree |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7226 +/- ##
=======================================
Coverage 96.47% 96.47%
=======================================
Files 1432 1432
Lines 342185 342235 +50
Branches 11280 11280
=======================================
+ Hits 330107 330187 +80
+ Misses 9227 9199 -28
+ Partials 2851 2849 -2 |
internal static partial class NS2 | ||
{ | ||
private static global::System.Resources.ResourceManager? s_resourceManager; | ||
public static global::System.Resources.ResourceManager ResourceManager => s_resourceManager ?? (s_resourceManager = new global::System.Resources.ResourceManager(typeof(TestProject.Resources))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Is this correct? Just want to make sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a comment that explains why this empty type is created:
Lines 573 to 575 in 7aba2ca
// resource name differs from the access class, need a type for specifying the resources | |
// this empty type must remain as it is required by the .NETNative toolchain for locating resources | |
// once assemblies have been merged into the application |
I'm not sure why we can't use the other type though (NS1.NS2
in this case).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why I omitted this during the initial implementation. 😆
Is there something else I need to do on my end? |
I'm not sure why the system hasn't registered your CLA acceptance. Can you try submitting another PR with something small like a test documentation change to see if it works there? |
Allows specifying the fully-qualified class name for the class that will be generated by ResxSourceGenerator.
System.Private.CoreLib
specifies the class nameSystem.SR
for a resource inResources\Strings.resx
:https://github.com/dotnet/runtime/blob/8ac30d41d0be7a6de919d765e0143af865371cd4/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj#L32-L37
This allows doing the same with the source generator, the property uses the same name (
ClassName
):The code for generating with a custom class name already existed, I only exposed it with the
ClassName
property.