Confusing AOT IL3035 error regarding Enums during Source Generation #112562
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Looks like some of the properties on This assignment then means that all methods on It's possible the app doesn't end up reflecting on that method, but the analysis doesn't try to prove things past what the annotation says. So a warning is generated. |
Beta Was this translation helpful? Give feedback.
Looks like some of the properties on
SourceGeneratedMethodInformation
are marked as[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)]
. My guess is that one of the types assigned to this property (on the line numbers reported by the analysis) are either enums, or have nested types that are enums (.All
includes nested types).This assignment then means that all methods on
System.Enum
should be considered targets of reflection (because.All
also means all methods, including inherited). But that includesEnum.GetValues(Type)
and this method is not safe to call in an AOT compiled app (it's marked asRequiredDynamicCode
).It's possible the app doesn't end up reflecting on that me…