IL2059: Unrecognized value passed to the type parameter of 'System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor'
Cause
An unrecognized value was passed to the type parameter of RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle).
Rule description
If the type passed to RunClassConstructor(RuntimeTypeHandle) is not statically known, the trimmer cannot guarantee the availability of the target static constructor.
Example
void TestMethod(Type type)
{
// IL2059 Trim analysis: Unrecognized value passed to the parameter 'type' of method 'System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle type)'.
// It's not possible to guarantee the availability of the target static constructor.
RuntimeHelpers.RunClassConstructor(type.TypeHandle);
}
Tilbakemeldinger
Send inn og vis tilbakemelding for