Skip to content

fix: Blazor WASM synchronous block#2116

Merged
glennawatson merged 1 commit into
reactiveui:mainfrom
xIceFox:fix/2115
Jun 4, 2026
Merged

fix: Blazor WASM synchronous block#2116
glennawatson merged 1 commit into
reactiveui:mainfrom
xIceFox:fix/2115

Conversation

@xIceFox
Copy link
Copy Markdown
Contributor

@xIceFox xIceFox commented Jun 3, 2026

What kind of change does this PR introduce?

Bug fix

What is the new behavior?

This PR should fix #2115

What is the current behavior?

The version 11.0.0 introduced a blocking call which breaks using refit in single threaded environments like blazor WASM.

What might this PR break?

None

Checklist

  • I have read the Contribute guide
  • Tests have been added or updated (for bug fixes / features)
  • Docs have been added or updated (for bug fixes / features)
  • Changes target the main branch
  • PR title follows Conventional Commits

Additional information

@begerard
Copy link
Copy Markdown

begerard commented Jun 3, 2026

This bug for WASM have been introduced in de57efa with this description:

Allow synchronous return types only for generated/non-public interface members by building a generated sync function path in RequestBuilderImplementation (BuildGeneratedSyncFuncForMethod, DeserializeSyncResponse).

I'm not sure to understand the end goal of @ChrisPulman but the use of Task.Run(taskFactory).GetAwaiter().GetResult(); to run the network task won't work on a single-thread only app like Blazor WASM.

That said, reverting only the change line 973+ without reverting other changes can be hazardous.

@xIceFox
Copy link
Copy Markdown
Contributor Author

xIceFox commented Jun 3, 2026

@begerard Thank you for the input, like I said to @glennawatson, I'm completely new to the codebase and im not 100% sure how my change affects other code, because this file is almost 2000 lines long. I traced it from the other side and understood the issue with the deadlock. It fixed the problem primarily, maybe there are better ways to approach this. You can of course take my changes as a start to do a better fix.

Would it be helpful to maybe identify the use cases and split up this file, so it is more maintainable?

@glennawatson
Copy link
Copy Markdown
Contributor

I will get @ChrisPulman to review it, but looks good to me. He's more onboard with the latest refit changes of late.

@glennawatson glennawatson requested a review from ChrisPulman June 4, 2026 01:41
@glennawatson glennawatson merged commit 8652c5e into reactiveui:main Jun 4, 2026
4 checks passed
@xIceFox xIceFox deleted the fix/2115 branch June 4, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Threading Exception in Blazor WebAssembly with Refit 10.1.7

4 participants