Closed sbomer closed 6 months ago
Tagging subscribers to this area: @dotnet/area-system-reflection See info in area-owners.md if you want to be subscribed.
Author: | sbomer |
---|---|
Assignees: | - |
Labels: | `area-System.Reflection` |
Milestone: | - |
I'll take a look
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas See info in area-owners.md if you want to be subscribed.
Author: | sbomer |
---|---|
Assignees: | - |
Labels: | `area-System.Reflection`, `untriaged`, `area-NativeAOT-coreclr` |
Milestone: | - |
The fix is to change this line: https://github.com/dotnet/runtime/blob/e4df4329df8e78c21530ae1f4af32dd87e950825/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMarker.cs#L87C29-L87C29
- ModuleDesc? callingModule = ((diagnosticContext.Origin.MemberDefinition as MethodDesc)?.OwningType as MetadataType)?.Module;
+ ModuleDesc? callingModule = (diagnosticContext.Origin.MemberDefinition.GetOwningType() as MetadataType)?.Module;
I won't try to create a PR as the tests will collide with https://github.com/dotnet/runtime/pull/92166. So it's better to wait for that to merge.
Using a type name string as an attribute property that has DynamicallyAccessedMembers requirements works when the attribute is on a method, but not on a field/property:
Not sure if I'm missing something, but this doesn't seem right.