-
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
Don't re-initialize static fields in Console #35409
Conversation
the compiler is not capable removing the initialization
Tagging subscribers to this area: @eiriktsarpalis |
It's fine to remove the |
It does not in all cases like this one. It does remove the assignments only where there is no needed assignment. Simple example bellow class C
{
static object o = new object ();
static bool b = false;
} |
If that's true that's a bug. Have you opened one on dotnet/roslyn? |
I see there are more cases like this in BCL (I used |
Tracking at dotnet/roslyn#43652 but I don't agree this is a bug. |
@EgorBo could you submit PR to clear them up? |
the compiler is not capable removing the initialization