-
Notifications
You must be signed in to change notification settings - Fork 462
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
Fix date format changing during UI updates by restoring request execution context #2643
Conversation
tests/Aspire.Dashboard.Tests/TelemetryRepositoryTests/LogTests.cs
Outdated
Show resolved
Hide resolved
Shouldn't Blazor's dispatcher be handling this automatically? |
No blazor doesn't handle this. This is when you have a callback API, you have to build something like this if you want to capture the ExecutionContext and have things like async locals work (that's also how you create a memory leak 😄 ) |
I expected it should. I expected |
It captures the sync context, not the execution context. |
The end result is weirdness around culture though 🤷♂️ Anyway, no automatic culture restore is the world we live in, and this change isn't big or complicated so I'm happy with this change to fix the problem. David, could you approve if the EC related code is good 🙏 |
Dont build callback APIs 😄 |
Would changing the subscription API to have an I could do that, but OTEL subscriptions are used in quite a few places. It would be a day of work to change the dashboard everywhere. Do you want that rather than adding execution context to the callback? |
@davidfowl Changes from offline conversation applied. |
Fixes #2554
Switching between date formats bug:
StateHasChanged()
.The fix is to capture the execution context when the Blazor page subscribes to telemetry changes, and then restore it when running the subcription. The restored Blazor execution context sets the right culture for the callback to run in.
@davidfowl You've worked with execution contexts the most here. Does this look right to you?
Microsoft Reviewers: Open in CodeFlow