-
Notifications
You must be signed in to change notification settings - Fork 262
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
Avoid more overhead of assembly initialize #4349
base: main
Are you sure you want to change the base?
Conversation
if (!testMethodInfo.Parent.Parent.IsAssemblyInitializeExecuted) | ||
{ | ||
assemblyInitializeResult = RunAssemblyInitializeIfNeeded(testMethodInfo, testContext); | ||
} | ||
|
||
if (assemblyInitializeResult != null && assemblyInitializeResult.Outcome != UnitTestOutcome.Passed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes the semantics of the code I think.
Previously, if assembly initialize failed, we will attach the failure for every single test run. While now, it's only attached for the first test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the code it looks like we prepare to capture outputs of the initialize method in every single test, but we actually run zero times or one time. so hopefully this changes nothing. We just prevent setting up capturing of output for method that will immediately return.
Looks like we are spending about 1% of the test run on 1k tests trying to setup assembly initialize contexts inside of RunAssemblyInitializeIfNeeded, only to enter the child method that would run AssemblyInitialize where we just return if we already run the code.