-
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
[release/8.0] Fix Options Source Gen RangeAttribute Thread Safety #97110
Conversation
Tagging subscribers to this area: @dotnet/area-extensions-options Issue DetailsFixes #97037 Backport of #97045 to release/8.0 /cc @tarekgh Customer ImpactApplications or libraries utilizing the Options validation source generator and employing the TestingI have included additional test cases to cover the specific scenario of concern, ensuring that the code passes all regression tests. This change has been manually tested too. RiskLow, the actual change here is ensuring the initialization code of the RangeAttribute execute inside a lock to ensure thread safety. IMPORTANT: If this backport is for a servicing release, please verify that:
|
<GeneratePackageOnBuild>false</GeneratePackageOnBuild> | ||
<ServicingVersion>1</ServicingVersion> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<ServicingVersion>2</ServicingVersion> |
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.
LGTM 👌
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.
@tarekgh let me know when the relevant CI legs have finished executing and they look good. This branch is restricted so I need to merge it.
Fixes #97037
Backport of #97045 to release/8.0
/cc @tarekgh
Customer Impact
Multi-threaded applications or libraries utilizing the Options validation source generator and employing the
RangeAttribute
validation attribute multiple times with identical parameters may encounter race conditions, leading to exceptions being thrown. This issue holds significance as certain extension libraries, such as the Http Resilient library, exhibit this problematic pattern, and we already have customers reporting issues with such libraries.Testing
I have included additional test cases to cover the specific scenario of concern, ensuring that the code passes all regression tests. This change has been manually tested too.
Risk
Low, the actual change here is ensuring the initialization code of the RangeAttribute execute inside a lock to ensure thread safety.
IMPORTANT: If this backport is for a servicing release, please verify that:
The PR target branch is
release/X.0-staging
, notrelease/X.0
.If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.