-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type preinitialization skips dataflow analysis #97286
Labels
Milestone
Comments
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsThere'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");
}
|
MichalStrehovsky
added a commit
to MichalStrehovsky/runtime
that referenced
this issue
Feb 12, 2024
Fixes dotnet#97286. This just aborts preinitialization if we see dataflow might be involved. It's a conservative fix. We don't have a good spot to communicate dataflow need (e.g. _everything_ from the cctor could potentially be optimized away if the codegen inlines that knowledge).
ghost
added
the
in-pr
There is an active PR which will close this issue when it is merged
label
Feb 12, 2024
MichalStrehovsky
added a commit
that referenced
this issue
Feb 13, 2024
Fixes #97286. This just aborts preinitialization if we see dataflow might be involved. It's a conservative fix. We don't have a good spot to communicate dataflow need (e.g. _everything_ from the cctor could potentially be optimized away if the codegen inlines that knowledge).
ghost
removed
the
in-pr
There is an active PR which will close this issue when it is merged
label
Feb 13, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
The text was updated successfully, but these errors were encountered: