Repository navigation
fix(client): avoid blocking SemaphoreSlim.Wait on browser-wasm; remove unused sync locks - #598
Merged
adrianhall merged 3 commits intoNov 5, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[UnsupportedOSPlatform("browser")]on blockingSemaphoreSlim.Wait(), so the firstPullAsyncthrewPlatformNotSupportedExceptionon browser-wasm. Based on the approach in Avoid blocking SemaphoreSlim.Wait in BuildDatasyncOfflineOptions for browser-wasm #575 (thanks @AtakanUk).src/calls the synchronousAcquireLockmethods. Removed them and their tests; the async variants stay.blazor-wasm.mdnow lists the two remaining known browser-wasm limitations (syncSaveChanges()and MD5 query IDs) rather than leaving them undiscovered. Blazor WASM offline mode remains unsupported.Evidence
BuildDatasyncOfflineOptions()reachesSemaphoreSlim.Wait()(CA1416 flags it withSupportedPlatform=browser; throws on .NET 11 browser-wasm per BuildDatasyncOfflineOptions throws PlatformNotSupportedException on .NET 11 Blazor WebAssembly #574).After: no blocking semaphore wait remains in the library.
dotnet test: all 12 test projects pass (Client: 1445 passed, 0 failed).Merge Danger
Door: two-way
Blast Radius: internal client locking
_optionsLockand both removed methods areinternal; no public API change.lockvsSemaphoreSlim: re-entrancy is now allowed (a user'sOnDatasyncInitializationthat re-entersBuildDatasyncOfflineOptionswould recurse instead of deadlock, both are user bugs), and calling it on a disposed context no longer throws from the semaphore.MD5.HashDatainPullRequestBuilderand the sync-over-async inUpdateOperationsQueue().