Skip to content
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

Trim analyzer produces unexpected IL2059 for nullable enum #109429

Closed
sbomer opened this issue Oct 31, 2024 · 1 comment · Fixed by #109430
Closed

Trim analyzer produces unexpected IL2059 for nullable enum #109429

sbomer opened this issue Oct 31, 2024 · 1 comment · Fixed by #109430
Assignees
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers in-pr There is an active PR which will close this issue when it is merged
Milestone

Comments

@sbomer
Copy link
Member

sbomer commented Oct 31, 2024

using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;

RuntimeHelpers.RunClassConstructor(typeof(Nullable<E>).TypeHandle);

enum E { }

This doesn't warn in ILLink, but does warn in the analyzer:

warning IL2059: Unrecognized value passed to the parameter 'type' of method 'System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle)'. It's not possible to guarantee the availability of the target static constructor.
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Oct 31, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Oct 31, 2024
@sbomer sbomer added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Oct 31, 2024
@sbomer sbomer self-assigned this Oct 31, 2024
@sbomer sbomer added this to the 10.0.0 milestone Oct 31, 2024
@sbomer sbomer removed untriaged New issue has not been triaged by the area owner needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Oct 31, 2024
Copy link
Contributor

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Oct 31, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 2, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers in-pr There is an active PR which will close this issue when it is merged
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant