-
Couldn't load subscription status.
- Fork 5.2k
Closed
Labels
Milestone
Description
There's an assignment to a DAM member but since we interpret the cctor instead of executing it, it bypasses the DAM annotations: this program will nullref at runtime.
This is a regression in 9.0.
using System;
using System.Diagnostics.CodeAnalysis;
Preinit.TheType.GetMethod("TheMethod").Invoke(null, []);
class Preinit
{
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)]
public static Type TheType = typeof(Preinit);
public static void TheMethod() => Console.WriteLine("Hello");
}Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status