-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix Incorrect RequiresDynamicCode attribute message #86602
Conversation
Replace GetEnumValues<TEnum> in the RequiresDynamicCode attribute message on System.Type.GetEnumValues, System.Reflection.SignatureType.GetEnumValues and System.Runtime.GetEnumValues with Enum.GetValues<T> with Enum.GetValues<T> Fix #86585
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsReplace GetEnumValues in the RequiresDynamicCode attribute message on System.Type.GetEnumValues, System.Reflection.SignatureType.GetEnumValues and System.Runtime.GetEnumValues with Enum.GetValues with Enum.GetValues Fix #86585
|
@dotnet-policy-service agree |
@@ -99,7 +99,7 @@ public sealed override Type MakeArrayType(int rank) | |||
public sealed override string GetEnumName(object value) => throw new NotSupportedException(SR.NotSupported_SignatureType); | |||
public sealed override string[] GetEnumNames() => throw new NotSupportedException(SR.NotSupported_SignatureType); | |||
public sealed override Type GetEnumUnderlyingType() => throw new NotSupportedException(SR.NotSupported_SignatureType); | |||
[RequiresDynamicCode("It might not be possible to create an array of the enum type at runtime. Use the GetEnumValues<TEnum> overload or the GetEnumValuesAsUnderlyingType method instead.")] | |||
[RequiresDynamicCode("It might not be possible to create an array of the enum type at runtime. Use the Enum.GetValues<T> overload or the GetEnumValuesAsUnderlyingType method instead.")] |
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.
[RequiresDynamicCode("It might not be possible to create an array of the enum type at runtime. Use the Enum.GetValues<T> overload or the GetEnumValuesAsUnderlyingType method instead.")] | |
[RequiresDynamicCode("It might not be possible to create an array of the enum type at runtime. Use Enum.GetValues<T> or the GetEnumValuesAsUnderlyingType method instead.")] |
Enum.GetValues is not overload of the annotated method.
The same change is going to be needed in the ref assembly too (src\libraries\System.Runtime\ref\System.Runtime.cs). |
Build error:
This needs to be fixed by adding a warning suppression to src/libraries/apicompat/ApiCompatBaseline.NetCoreAppLatestStable.xml . (For example, look at the suppression added in https://github.com/dotnet/runtime/pull/84369/files for similar problem.) |
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.
Thank you!
Replace GetEnumValues in the RequiresDynamicCode attribute message on System.Type.GetEnumValues, System.Reflection.SignatureType.GetEnumValues and System.Runtime.GetEnumValues with Enum.GetValues with Enum.GetValues
Fix #86585