Remove eager initialization of _startupScripts to enable lazy thread-safe initialization#25767
Conversation
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
…d-safe initialization The field `_startupScripts` was being initialized at declaration, which prevented the `Interlocked.CompareExchange` logic in the `StartupScripts` property from ever executing. This change removes the eager initialization to allow proper lazy and thread-safe setup of the HashSet when the property is first accessed.
85e810f to
0016bbf
Compare
|
@xtqqczze Can you please revert the 2nd commit? I think only the 1st commit will do the trick. Thanks! |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR fixes lazy, thread-safe initialization of StartupScripts by removing eager initialization of the backing field so the Interlocked.CompareExchange path can execute as intended.
Changes:
- Removed inline initialization of
_startupScriptsso theStartupScriptsproperty can lazily initialize it on first access.
|
The CodeQL Analysis task got skipped due to a change of the task:
It's not related to this PR, so I will merge it. |
…d-safe initialization (PowerShell#25767)
The field
_startupScriptswas being initialized at declaration, which prevented theInterlocked.CompareExchangelogic in theStartupScriptsproperty from ever executing.This change removes the eager initialization to allow proper lazy and thread-safe setup
of the
HashSetwhen the property is first accessed.