Skip to content

Trim analyzer produces unexpected IL2059 for nullable enum #109429

@sbomer

Description

@sbomer
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.

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzersin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions