-
-
Notifications
You must be signed in to change notification settings - Fork 110
perf: use shared Task.FromResult(Passed)
#4524
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
Conversation
585c460 to
a56f349
Compare
SummaryThis PR introduces a shared static cached Critical IssuesCRITICAL: Static field initialization bug The new field in internal static Task<AssertionResult> _passedTask = Task.FromResult(Passed);This creates a static initialization order issue. The More importantly: The public static AssertionResult Passed => new(true, string.Empty);This means Recommendation: Make the initialization explicit and safe: internal static readonly Task<AssertionResult> _passedTask = Task.FromResult(new AssertionResult(true, string.Empty));And add Minor: Field naming convention The field Suggestions
Verdict |
a56f349 to
f2b032c
Compare
|
Use return a shared static
Task.FromResult(Passed)for successful assertions. This should be safe becauseAssertionResultis areadonly structBefore
After