Just fiddling around, I launch my app with Ctrl+F5 in VS2022. Then launched a browser for that instance.
With the browser still open, I killed the instance and the "rejoin" component displays because the server is gone. All as expected.
I restarted the server and got the exception below. I think it's an edge case but might be significant. The server seems to recover, but the client gets the exception (because it's web sockets, I guess). Not really sure what happened to the state at that point.
[15:25:34 ERR] An unhandled exception has occurred while executing the request.
AnyClone.CloneException: Failed to set field value named '<CancellationTokenSource>k__BackingField' at path '' using IL DynamicMethod
---> System.ArgumentException: An item with the same key has already been added. Key: AnyClone.ILCacheKey
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
at AnyClone.CloneProvider`1.GetWriterForField(FieldInfo field)
at AnyClone.CloneProvider`1.InspectAndCopy(Object sourceObject, Object destinationObject, Type destinationObjectType, Int32 currentDepth, Int32 maxDepth, CloneConfiguration configuration, ObjectTreeReferenceTracker objectTree, String path, ICollection`1 ignorePropertiesOrPaths)
--- End of inner exception stack trace ---
at AnyClone.CloneProvider`1.InspectAndCopy(Object sourceObject, Object destinationObject, Type destinationObjectType, Int32 currentDepth, Int32 maxDepth, CloneConfiguration configuration, ObjectTreeReferenceTracker objectTree, String path, ICollection`1 ignorePropertiesOrPaths)
at AnyClone.CloneProvider`1.InspectAndCopy(Object sourceObject, Int32 currentDepth, Int32 maxDepth, CloneConfiguration configuration, ObjectTreeReferenceTracker objectTree, String path)
at AnyClone.CloneProvider`1.Clone(T sourceObject, CloneOptions options)
at AnyClone.CloneExtensions.Clone[T](T sourceObject, CloneOptions options, Action`4 onErrorCallback)
at AnyClone.CloneExtensions.Clone[T](T sourceObject, Action`4 onErrorCallback)
at TimeWarp.Features.StateTransactions.StateTransactionBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
at MediatR.Pipeline.RequestPreProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
at MediatR.Pipeline.RequestPostProcessorBehavior`2.Handle(TRequest request, RequestHandlerDelegate`1 next, CancellationToken cancellationToken)
at Sezami.BitUi.Client.Features.Users.UserState.SetUser(UserDto user, Nullable`1 externalCancellationToken) in E:\repos\SezamiModular\src\Sezami.BitUi\Sezami.BitUi.Client\obj\Debug\net9.0\TimeWarp.State.SourceGenerator\TimeWarp.State.SourceGenerator.ActionSetMethodSourceGenerator\Sezami.BitUi.Client.Features.Users.UserState.SetUserActionSet_Method.g.cs:line 17
at Sezami.BitUi.Client.Routes.LoadUser() in E:\repos\SezamiModular\src\Sezami.BitUi\Sezami.BitUi.Client\Routes.razor:line 112
at Sezami.BitUi.Client.Routes.OnNavigateAsync(NavigationContext args) in E:\repos\SezamiModular\src\Sezami.BitUi\Sezami.BitUi.Client\Routes.razor:line 91
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.Routing.Router.RunOnNavigateAsync(String path, Boolean isNavigationIntercepted)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.AddToRenderQueue(Int32 componentId, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.Routing.Router.RunOnNavigateAsync(String path, Boolean isNavigationIntercepted)
at Microsoft.AspNetCore.Components.Routing.Router.SetParametersAsync(ParameterView parameters)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
at Microsoft.AspNetCore.Components.Endpoints.EndpointHtmlRenderer.<WaitForNonStreamingPendingTasks>g__Execute|43_0()
at Microsoft.AspNetCore.Components.Endpoints.EndpointHtmlRenderer.WaitForResultReady(Boolean waitForQuiescence, PrerenderedComponentHtmlContent result)
at Microsoft.AspNetCore.Components.Endpoints.EndpointHtmlRenderer.RenderEndpointComponent(HttpContext httpContext, Type rootComponentType, ParameterView parameters, Boolean waitForQuiescence)
at Microsoft.AspNetCore.Components.Endpoints.RazorComponentEndpointInvoker.RenderComponentCore(HttpContext context)
at Microsoft.AspNetCore.Components.Endpoints.RazorComponentEndpointInvoker.RenderComponentCore(HttpContext context)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c.<<InvokeAsync>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Builder.ServerRazorComponentsEndpointConventionBuilderExtensions.<>c__DisplayClass1_1.<<AddInteractiveServerRenderMode>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Shared.Server.Middleware.Api.ClaimsTransformationFilter.InvokeAsync(HttpContext context) in E:\repos\SezamiModular\src\Shared.Server\Middleware\Api\ClaimsTransformationFilter.cs:line 24
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
[15:25:34 INF] Middleware: MapMembershipsToClaimsPrincipal called
Just fiddling around, I launch my app with Ctrl+F5 in VS2022. Then launched a browser for that instance.
With the browser still open, I killed the instance and the "rejoin" component displays because the server is gone. All as expected.
I restarted the server and got the exception below. I think it's an edge case but might be significant. The server seems to recover, but the client gets the exception (because it's web sockets, I guess). Not really sure what happened to the state at that point.
AnyCloneis complaining...