-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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] [Blazor] Close the circuit when all Blazor Server components are disposed #50170
Conversation
src/Components/Web.JS/src/Platform/Circuits/CircuitDotNetCallDispatcher.ts
Outdated
Show resolved
Hide resolved
export async function disposeCircuit() { | ||
if (!circuitActive) { | ||
return; | ||
} | ||
|
||
circuitActive = false; | ||
|
||
await startCircuitPromise; | ||
|
||
if (circuitActive) { | ||
// A call to 'startCircuit' was made while we were waiting to dispose the circuit. | ||
// Therefore, we should abort the disposal. | ||
return; | ||
} |
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.
I appreciate that logic like this can be a bit hard to follow. Unfortunately, we have a recurring problem in Blazor's JS implementation where an assumption was previously made that certain state should be "static" / "singleton" / "module-level", when in fact it's actually better represented as being instance state with a limited lifetime.
In this example, it would be better if there was a more concrete concept of a "circuit" instance on the JavaScript side, where that circuit can be disposed and a new one can be created. This allows a separate copy of state to exist on each circuit instance, so you don't end up with tricky synchronization/ordering challenges during disposal/initialization.
Unfortunately, these kinds of challenges already existed in this file with the disconnection/reconnection logic. It would be possible for us to through and rework this file to use instance-level state (rather than module-level state) at the risk of us potentially changing something subtle in the existing initialization/reconnection logic behavior. Maybe it's worth doing this now, or maybe this is something we should look into more closely for .NET 9.
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.
Yeah, this is tricky. I do think the Web.JS
code during .NET 8 has gone from "of mixed quality" to "needs a very thorough rewrite if we're going to maintain and expand this long term". It's always been a lower priority than the C# that runs server-side, and its smallness used to let us get away with idiosyncrasies, but it's no longer small and gets ever more spaghettified.
So I would say:
- For .NET 8, let's follow your judgement about how much tidying is needed in the short term. We need correctness and to avoid too much weirdness that will make debugging difficult (especially given we may still be patching 8.0 three years from now).
- For .NET 9, we should be prepared to eat the cost of a bigger renovation of the JS/TS code. I would hope that in something like 3-4 weeks we could thoroughly go through each part of it and replace each functional area with a more modern, tidy, instance-oriented implementation with some Jest tests. We would come up with sensible new abstractions that link together the major pieces without them all reaching into each other's internals. (In theory we could even attempt a from-scratch reimplementation but that would be braver.)
- I mean all of it, including rendering, event handling, etc. - not just circuit management.
- A major asset for us is the E2E tests which are really thorough in most aspects, so we should have good confidence about correctness. That's even more so now a lot of the WebAssembly startup flow is outside this repo, so we no longer have to worry about recreating all the semantics around loading and any errors that can occur.
@MackinnonBuck What do you think? If you think we should be tackling any of this sooner, or if you have views on the best approach to renovate this in .NET 9, that's definitely worth discussion.
@mkArtakMSFT What do you think? Would you be prepared to put that much investment in this area in .NET 9? You could think of it as being similar to the big project to align the WebAssembly SDKs - we found time for that in .NET 8 so hopefully we have capacity for a similarly large investment in long term code quality in .NET 9.
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.
@SteveSandersonMS I definitely agree that a thorough rework of the JS/TS code is required, and I think this is something we should prioritize early in .NET 9, especially if we intend to do some of the other tracked blazor.*.js
improvements to support things like microfrontend scenarios, etc.
Regarding circuit management, I've decided to update the implementation now to significantly clean up Boot.Server.Common.ts
. A lot has been moved to CircuitManager.ts
, which now logically represents the state and lifetime of a single circuit (whose connection can be closed and reinitialized an arbitrary number of times). While it's a fairly large change, it should be easier to reason about and fix bugs going forward.
I thought that since render batches (on the client) imply interactive rendering, and interactive components can't contain other interactive root components, this shouldn't be the case. Could you clarify what, if anything, I'm missing? Thanks! |
A render batch is still sent to the browser for root component disposal, which causes the component to be unregistered as a root component in |
// We dispose the .NET dispatcher to prevent it from being used in the future. | ||
// This avoids cases where, for example, .NET object references from a | ||
// disconnected circuit start pointing to .NET objects for a new circuit. | ||
dotNetDispatcher.dispose(); |
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.
That's an excellent thing to anticipate. Nice!
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.
Don't worry folks, the TS39 has you covered https://github.com/tc39/proposal-explicit-resource-management#motivations
I'm surprised that The only reason I'm asking is that rendering happens thousands of times more often than the set of root components changing, possibly even at 60fps or more (with any number of batches per frame), so taking work out of the core render cycle has benefits. Of course, if the amount of work in checking for an empty set of root components is near-zero then it wouldn't matter. |
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.
Looks good!
The sheer amount of changes to how things are wired together is definitely beyond what I can build a mental model for while reading the code, so I definitely can't predict whether there are edge cases where things get stale or similar. Long term I think we need to be prepared for a broader restructure, but I definitely appreciate right now you're making the best choices about working within the existing system.
If there's anything you feel suspicious or uncertain about whether we know it's correct please say so and I'll be happy to help reason about the edge cases.
Also this will need to be retargeted to |
d501c5f
to
5177378
Compare
Thanks for the review, @SteveSandersonMS!
Unfortunately, it doesn't. It's meant to act as the middleman that keeps in sync SSR'd components and their corresponding interactive components, so it doesn't know anything about root components that get created by other means.
In the common case where root components do exist, the impact isn't measurable (at least from my testing with |
* Remove reflection from KestrelServer constructor (#50272) * Update dependencies from https://github.com/dotnet/extensions build 20230822.1 (#50288) [release/8.0] Update dependencies from dotnet/extensions * Ensure enhanced nav requests have the correct headers (#50263) * In SSR, supply HttpContext as cascading value (#50253) Fixes #48769 ### Usage ```cs [CascadingParameter] public HttpContext? Context { get; set; } ``` In SSR, this will receive the `HttpContext`. In other rendering modes where there is no HTTP context, no value will be supplied so the property will remain `null`. ### Alternative design considered In #48769 I suggested using `[SupplyParameterFromHttpContext]` but that turns out not to be practical unless we either (a) make `ICascadingValueSupplier` public, or (b) add an IVT from `M.A.Components` to `.Endpoints`. I'm not keen on doing either of the above on a whim. Plus, use of `[CascadingValue]` has advantages: * It's consistent with the existing pattern for authentication state (we have `[CascadingParameter] Task<AuthenticationState> AuthenticationStateTask { get; set; }`). * Longer term, if we add more things like this, it would be nice not to add a separate special attribute for each one when `[CascadingParameter]` is already descriptive enough. Special attributes are needed only when the type of thing being supplied might reasonably clash with something else the application is doing (for example, we do need it for form/query, as they supply arbitrary types). ## Review notes It's best to look at the two commits in this PR completely separately: 1. The first commit fixes an API design problem I discovered while considering how to do this. I realised that when we added `CascadingParameterAttributeBase`, we made a design mistake: * We put the `Name` property on the abstract base class just because `CascadingParameterAttribute`, `SupplyParameterFromQuery`, and `SupplyParameterFromForm` all have a `Name`. * However, in all three cases there, the `Name` has completely different meanings. For `CascadingParameterAttribute`, it's the name associated with `<CascadingValue Name=...>`, whereas for form it's the `Request.Form` entry or fall back on property name, and for query it's the `Request.Query` entry or fall back on property name. In general there's no reason why a `CascadingParameterAttributeBase` subclass should have a `Name` at all (`SupplyParameterFromHttpContext` wasn't going to), and if it does have one, its semantics are specific to it. So these should not be the same properties. * The change we made to make `CascadingParameterAttribute.Name` virtual might even be breaking (see https://learn.microsoft.com/en-us/dotnet/core/compatibility/library-change-rules stating *DISALLOWED: Adding the virtual keyword to a member*). So it's good we can revert that here. 2. The second commit is the completely trivial implementation of supplying `HttpContext` as a cascading value, with an E2E test. * Fix SSR redirections. Fixes #49670 (#50261) Fixes #49670 trivially by making `HttpNavigationManager`'s redirection logic consistent with the other `NavigationManager` implementations. You'll be wondering why there are no E2E tests with this PR. The reason is that, surprisingly, we *already* have E2E tests for these kinds of non-root redirections. However, they were falsely passing, which is tracked by #50260 and is outside the scope of this PR. I think we should address that other issue in .NET 9 as there should be no developer/API impact from leaving it as-is for .NET 8. * API review followups (#50181) * RazorComponentResult: change namespace, make executor internal, merge test classes * RazorComponentResult: Nullability and trim annotations * RazorComponentResult: IStatusCodeHttpResult and IContentTypeHttpResult * Cleanup * Further clean up annotations * Remove HtmlRootComponent.ComponentId as per API review * Rename SupplyParameterFromFormAttribute.Handler to FormName * API review: seal * Clarify RenderModeAttribute inheritance. Fixes #49848 * Rename valueFactory -> initialValueFactory * Remove unnecessary sequence params * Make [StreamRendering] default to true * Support hot reload for Blazor component endpoints (#50031) * Support hot reload for Blazor component endpoints * Use alternative navigation exports * Address feedback * Make HotReloadService optional * Address more feedback * [release/8.0] Update SDK (#50276) * [release/8.0] Update SDK * Fix IsAotCompatible warnings * Update nullability annotation for TemplatePart.Text * Update CodeGen.proj to account for conditional IsTrimmable metadata * Update Directory.Build.props.in --------- Co-authored-by: Stephen Halter <halter73@gmail.com> * Provide a better error (#50311) * Remove more setup overhead in RDG benchmarks (#50302) * Use polling to watch certificate paths (#50251) * Cache parsable and bindable type info in RDG (#50326) * Use absolute URLs for confirmation emails (#50297) This PR updates the MapIdentityApi endpoints that send confirmation emails to use absolute URLs. Previously the emails used relative links which of course do not work for links in emails. Fixes #50296 * [release/8.0] [Blazor] Close the circuit when all Blazor Server components are disposed (#50170) # [Blazor] Close the circuit when all Blazor Server components are disposed Allows a Blazor Server circuit to close when all root Blazor Server components get dynamically removed from the page. ## Description The overall approach I've taken is: 1. Define what it means for the circuit to be in use (`WebRootComponentManager.hasAnyExistingOrPendingServerComponents()`): * There are interactive Blazor Server components on the page, or... * The initialization of an interactive Blazor Server component has started, but hasn't completed yet, or... * There are SSR'd components on the page that haven't been initialized for interactivity yet (consider stream rendering, where we don't activate new components until the response completes), but they have either a "Server" or "Auto" render mode 2. Determine the cases where a circuit's "in use" status may have changed: * After a render batch is applied (see `attachCircuitAfterRenderCallback` in `WebRootComponentManager.ts`) * An applied render batch may result in the creation/disposal of a root component * After an SSR update occurs, but before the first render batch is applied * Consider the case where an SSR'd component with a Server render mode gets removed from the page, but before the circuit has a chance to initialize 3. Decide what to do if the "in use" status may have changed (`WebRootComponentManager.circuitMayHaveNoRootComponents()`): * If the circuit is not in use: * Start a timeout with some configurable duration (`SsrStartOptions.circuitInactivityTimeoutMs`), if it hasn't started already * When the timeout expires, dispose the circuit * If the circuit is not in use: * Clear any existing timeout This PR also: - [X] Addresses a bug preventing Virtualize from working correctly when a WebAssembly and Server instance is present on the page at the same time - [X] Adds E2E tests Fixes #48765 * [release/8.0] Update dependencies from dotnet/runtime (#50305) * Update dependencies from https://github.com/dotnet/runtime build 20230823.11 Microsoft.Bcl.AsyncInterfaces , Microsoft.Bcl.TimeProvider , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.Json , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.Configuration.Xml , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.Diagnostics , Microsoft.Extensions.Diagnostics.Abstractions , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.HostFactoryResolver.Sources , Microsoft.Extensions.Hosting , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Http , Microsoft.Extensions.Logging , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , Microsoft.NETCore.Platforms , System.Collections.Immutable , System.Composition , System.Configuration.ConfigurationManager , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices.Protocols , System.IO.Hashing , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Reflection.Metadata , System.Resources.Extensions , System.Runtime.Caching , System.Security.Cryptography.Pkcs , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceProcess.ServiceController , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Threading.Channels , System.Threading.RateLimiting From Version 8.0.0-rc.2.23418.14 -> To Version 8.0.0-rc.2.23423.11 * Update dependencies from https://github.com/dotnet/runtime build 20230823.5 Microsoft.Bcl.AsyncInterfaces , Microsoft.Bcl.TimeProvider , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.Json , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.Configuration.Xml , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.Diagnostics , Microsoft.Extensions.Diagnostics.Abstractions , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.HostFactoryResolver.Sources , Microsoft.Extensions.Hosting , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Http , Microsoft.Extensions.Logging , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , Microsoft.NETCore.Platforms , System.Collections.Immutable , System.Composition , System.Configuration.ConfigurationManager , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices.Protocols , System.IO.Hashing , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Reflection.Metadata , System.Resources.Extensions , System.Runtime.Caching , System.Security.Cryptography.Pkcs , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceProcess.ServiceController , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Threading.Channels , System.Threading.RateLimiting From Version 8.0.0-rc.2.23418.14 -> To Version 8.0.0-rc.2.23423.5 --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * Update Version.Details.xml * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20230824.1 (#50337) [release/8.0] Update dependencies from dotnet/source-build-reference-packages * Update Microsoft.Identity.Model to 7.0.0-preview3 (#50218) * Update Microsoft.Identity.Model to 7.0.0-preview3 * fixing null refs in WsFed * Add link to tracking issue. * Add link to tracking issue. * Update dependencies from https://github.com/dotnet/source-build-externals build 20230824.1 Microsoft.SourceBuild.Intermediate.source-build-externals From Version 8.0.0-alpha.1.23421.1 -> To Version 8.0.0-alpha.1.23424.1 * Workaround AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet#2261 in a test. --------- Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * Update Versions.props * Quarantine tests (#50379) Co-authored-by: Mackinnon Buck <mackinnon.buck@gmail.com> * [release/8.0] Update dependencies from dotnet/runtime (#50350) * Update dependencies from https://github.com/dotnet/runtime build 20230825.9 Microsoft.Bcl.AsyncInterfaces , Microsoft.Bcl.TimeProvider , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.Json , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.Configuration.Xml , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.Diagnostics , Microsoft.Extensions.Diagnostics.Abstractions , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.HostFactoryResolver.Sources , Microsoft.Extensions.Hosting , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Http , Microsoft.Extensions.Logging , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , Microsoft.NETCore.Platforms , System.Collections.Immutable , System.Composition , System.Configuration.ConfigurationManager , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices.Protocols , System.IO.Hashing , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Reflection.Metadata , System.Resources.Extensions , System.Runtime.Caching , System.Security.Cryptography.Pkcs , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceProcess.ServiceController , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Threading.Channels , System.Threading.RateLimiting From Version 8.0.0-rc.2.23423.5 -> To Version 8.0.0-rc.2.23425.9 * Update dependencies from https://github.com/dotnet/runtime build 20230826.4 Microsoft.Bcl.AsyncInterfaces , Microsoft.Bcl.TimeProvider , Microsoft.Extensions.Caching.Abstractions , Microsoft.Extensions.Caching.Memory , Microsoft.Extensions.Configuration , Microsoft.Extensions.Configuration.Abstractions , Microsoft.Extensions.Configuration.Binder , Microsoft.Extensions.Configuration.CommandLine , Microsoft.Extensions.Configuration.EnvironmentVariables , Microsoft.Extensions.Configuration.FileExtensions , Microsoft.Extensions.Configuration.Ini , Microsoft.Extensions.Configuration.Json , Microsoft.Extensions.Configuration.UserSecrets , Microsoft.Extensions.Configuration.Xml , Microsoft.Extensions.DependencyInjection , Microsoft.Extensions.DependencyInjection.Abstractions , Microsoft.Extensions.DependencyModel , Microsoft.Extensions.Diagnostics , Microsoft.Extensions.Diagnostics.Abstractions , Microsoft.Extensions.FileProviders.Abstractions , Microsoft.Extensions.FileProviders.Composite , Microsoft.Extensions.FileProviders.Physical , Microsoft.Extensions.FileSystemGlobbing , Microsoft.Extensions.HostFactoryResolver.Sources , Microsoft.Extensions.Hosting , Microsoft.Extensions.Hosting.Abstractions , Microsoft.Extensions.Http , Microsoft.Extensions.Logging , Microsoft.Extensions.Logging.Abstractions , Microsoft.Extensions.Logging.Configuration , Microsoft.Extensions.Logging.Console , Microsoft.Extensions.Logging.Debug , Microsoft.Extensions.Logging.EventLog , Microsoft.Extensions.Logging.EventSource , Microsoft.Extensions.Logging.TraceSource , Microsoft.Extensions.Options , Microsoft.Extensions.Options.ConfigurationExtensions , Microsoft.Extensions.Options.DataAnnotations , Microsoft.Extensions.Primitives , Microsoft.Internal.Runtime.AspNetCore.Transport , Microsoft.NET.Runtime.MonoAOTCompiler.Task , Microsoft.NET.Runtime.WebAssembly.Sdk , Microsoft.NETCore.App.Ref , Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.BrowserDebugHost.Transport , Microsoft.NETCore.Platforms , System.Collections.Immutable , System.Composition , System.Configuration.ConfigurationManager , System.Diagnostics.DiagnosticSource , System.Diagnostics.EventLog , System.Diagnostics.PerformanceCounter , System.DirectoryServices.Protocols , System.IO.Hashing , System.IO.Pipelines , System.Net.Http.Json , System.Net.Http.WinHttpHandler , System.Reflection.Metadata , System.Resources.Extensions , System.Runtime.Caching , System.Security.Cryptography.Pkcs , System.Security.Cryptography.Xml , System.Security.Permissions , System.ServiceProcess.ServiceController , System.Text.Encodings.Web , System.Text.Json , System.Threading.AccessControl , System.Threading.Channels , System.Threading.RateLimiting From Version 8.0.0-rc.2.23423.5 -> To Version 8.0.0-rc.2.23426.4 --------- Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * Update Versions.props --------- Co-authored-by: Stephen Halter <halter73@gmail.com> Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Steve Sanderson <SteveSandersonMS@users.noreply.github.com> Co-authored-by: Safia Abdalla <safia@microsoft.com> Co-authored-by: Andrew Casey <amcasey@users.noreply.github.com> Co-authored-by: Mackinnon Buck <mackinnon.buck@gmail.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: jennyf19 <jeferrie@microsoft.com> Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com> Co-authored-by: William Godbe <wigodbe@microsoft.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
[Blazor] Close the circuit when all Blazor Server components are disposed
Allows a Blazor Server circuit to close when all root Blazor Server components get dynamically removed from the page.
Description
The overall approach I've taken is:
WebRootComponentManager.hasAnyExistingOrPendingServerComponents()
):attachCircuitAfterRenderCallback
inWebRootComponentManager.ts
)WebRootComponentManager.circuitMayHaveNoRootComponents()
):SsrStartOptions.circuitInactivityTimeoutMs
), if it hasn't started alreadyThis PR also:
Fixes #48765