-
Notifications
You must be signed in to change notification settings - Fork 986
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
Remove STA thread affinitisation (servicing) #5953
Remove STA thread affinitisation (servicing) #5953
Conversation
Application bootstrap was designed and built before the file-scope namespaces became a thing, and supported a) the original namespace declarations, and b) the new top level statements declarations. In the case of top level statements there is no `Main()` method on to which a developer can apply `STAThreadAttribute`, and to accommodate this use case we added explicit STA thread affinitisation. The same code gets emitted for file-scope namespace declarations, which is undesirable, as it has overhead and perf implications. Whilst the top level statements are supported in Windows Forms, those don't represent the main use case, and any developer who wishes to use top level statements in Program.cs can write STA thread affinitisation statements by hand.
This comment has been minimized.
This comment has been minimized.
Any issue associated with this for the background? |
This comment has been minimized.
This comment has been minimized.
I discovered this myself during exploratory testing of the the new feature.
Please let me know if you have any questions. |
@Olina-Zhang please add this into a verification runsheet. Thank you. |
Will add it to regular checking. |
Application bootstrap was designed and built before the file-scope namespaces became a thing, and supported
a) the original namespace declarations, and
b) the new top level statements declarations.
In the case of top level statements there is no
Main()
method on to which a developer can applySTAThreadAttribute
, and to accommodate this use case we added explicit STA thread affinitisation.The same code gets emitted for file-scope namespace declarations, which is undesirable, as it has overhead and perf implications.
Whilst the top level statements are supported in Windows Forms, those don't represent the main use case, and any developer who wishes to use top level statements in Program.cs can write STA thread affinitisation statements by hand.
Customer Impact
Regression?
Application.Initialize()
is a new feature in .NET 6.0Risk
Microsoft Reviewers: Open in CodeFlow