Odd error #308
Replies: 1 comment 1 reply
-
It looks like an error when trying to clone the MudTheme object. I am going to guess at your scenario here so I apologize if I am wrong. I am assuming you want to support 2 themes, Dark and Light. And both of these Themes are constants and never change, just the user switches back and forth. If that is the case I wouldn't even store the MudTheme itself in the store. Instead store an enum Dark/Light. Then use this enum to select your MudTheme from a const array/list. If the MudTheme isn't const and you do need it in the store and AnyClone can't clone it (the error you are seeing) then you will have to write you own clone method and implement ICloneable. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Good day, I have a very strange error I was hoping you can help with. I am not sure it's a bug so I figured I won't pollute "Issues" and put it here.
What I am trying to do here is set a MudBlazor (blazor UI controls library) theme state using BlazorState to have it available in other parts of the application.
Some code - ThemseState defenition
Now when I try to set the state
await Mediator.Send(new ThemeState.SetThemeAction { Theme = new Blue()});
I get an errorEDIT: I noticed that this happens on the second
await Mediator.Send
call. The first one works fine but updateting the state for the second time gets the below error.blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: NoMatch
System.InvalidOperationException: NoMatch
at System.Linq.ThrowHelper.ThrowNoMatchException()
at System.Linq.Enumerable.Single[PropertyInfo](IEnumerable
1 , Func
2 )at TypeSupport.Extensions.TypeExtensions.GetExtendedProperty(Type type, String name, Type declaringType)
at TypeSupport.Extensions.TypeExtensions.GetExtendedProperty(ExtendedType type, String name, Type declaringType)
at TypeSupport.ExtendedField..ctor(FieldInfo fieldInfo, <093ccf36-0860-4190-a408-07485a540c05>TypeSupportOptions typeSupportOptions)
at TypeSupport.Extensions.TypeExtensions.<>c__DisplayClass4_0.b__0(FieldInfo x)
at System.Linq.Enumerable.SelectArrayIterator
2[[System.Reflection.FieldInfo, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[TypeSupport.<b4311ab7-2912-4fdb-93cb-4eada66de6d7>ExtendedField, AnyClone, Version=1.1.2.0, Culture=neutral, PublicKeyToken=ce8a1a9d68396c39]].MoveNext() at System.Linq.Enumerable.ConcatIterator
1[[TypeSupport.ExtendedField, AnyClone, Version=1.1.2.0, Culture=neutral, PublicKeyToken=ce8a1a9d68396c39]].MoveNext()at System.Collections.Generic.List
1[[TypeSupport.<b4311ab7-2912-4fdb-93cb-4eada66de6d7>ExtendedField, AnyClone, Version=1.1.2.0, Culture=neutral, PublicKeyToken=ce8a1a9d68396c39]]..ctor(IEnumerable
1 )at System.Linq.Enumerable.ToListExtendedField
at TypeSupport.Extensions.TypeExtensions.GetFields(Type type, <592c84b9-f941-4a62-9e7a-1c2d0ed3f520>FieldOptions options, <093ccf36-0860-4190-a408-07485a540c05>TypeSupportOptions propogateTypeSupportOptions)
at TypeSupport.TypeInspector.InspectFields()
at TypeSupport.ExtendedType.get_Fields()
at AnyClone.CloneProvider
1[[BlazorState.IState, Blazor-State, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].InspectAndCopy(Object sourceObject, Object destinationObject, Type destinationObjectType, Int32 currentDepth, Int32 maxDepth, CloneConfiguration configuration, ObjectTreeReferenceTracker objectTree, String path, ICollection
1 ignorePropertiesOrPaths)at AnyClone.CloneProvider
1[[BlazorState.IState, Blazor-State, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].InspectAndCopy(Object sourceObject, Object destinationObject, Type destinationObjectType, Int32 currentDepth, Int32 maxDepth, CloneConfiguration configuration, ObjectTreeReferenceTracker objectTree, String path, ICollection
1 ignorePropertiesOrPaths)at AnyClone.CloneProvider
1[[BlazorState.IState, Blazor-State, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].InspectAndCopy(Object sourceObject, Object destinationObject, Type destinationObjectType, Int32 currentDepth, Int32 maxDepth, CloneConfiguration configuration, ObjectTreeReferenceTracker objectTree, String path, ICollection
1 ignorePropertiesOrPaths)at AnyClone.CloneProvider
1[[BlazorState.IState, Blazor-State, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].InspectAndCopy(Object sourceObject, Int32 currentDepth, Int32 maxDepth, CloneConfiguration configuration, ObjectTreeReferenceTracker objectTree, String path) at AnyClone.CloneProvider
1[[BlazorState.IState, Blazor-State, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].Clone(IState sourceObject, CloneConfiguration configuration)at AnyClone.CloneExtensions.Clone[IState](IState sourceObject, CloneConfiguration configuration)
at AnyClone.CloneExtensions.Clone[IState](IState sourceObject)
at BlazorState.Pipeline.State.CloneStateBehavior
2.<Handle>d__5[[TPL.Client.Core.States.Theme.ThemeState.SetThemeAction, TPL.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MediatR.Unit, MediatR.Contracts, Version=1.0.1.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2]].MoveNext() at MediatR.Pipeline.RequestExceptionProcessorBehavior
2.d__2[[TPL.Client.Core.States.Theme.ThemeState.SetThemeAction, TPL.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MediatR.Unit, MediatR.Contracts, Version=1.0.1.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2]].MoveNext()at MediatR.Pipeline.RequestExceptionProcessorBehavior
2.<Handle>d__2[[TPL.Client.Core.States.Theme.ThemeState.SetThemeAction, TPL.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MediatR.Unit, MediatR.Contracts, Version=1.0.1.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2]].MoveNext() at MediatR.Pipeline.RequestExceptionActionProcessorBehavior
2.d__2[[TPL.Client.Core.States.Theme.ThemeState.SetThemeAction, TPL.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MediatR.Unit, MediatR.Contracts, Version=1.0.1.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2]].MoveNext()at MediatR.Pipeline.RequestExceptionActionProcessorBehavior
2.<Handle>d__2[[TPL.Client.Core.States.Theme.ThemeState.SetThemeAction, TPL.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MediatR.Unit, MediatR.Contracts, Version=1.0.1.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2]].MoveNext() at MediatR.Pipeline.RequestPostProcessorBehavior
2.d__2[[TPL.Client.Core.States.Theme.ThemeState.SetThemeAction, TPL.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MediatR.Unit, MediatR.Contracts, Version=1.0.1.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2]].MoveNext()at MediatR.Pipeline.RequestPreProcessorBehavior`2.d__2[[TPL.Client.Core.States.Theme.ThemeState.SetThemeAction, TPL.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MediatR.Unit, MediatR.Contracts, Version=1.0.1.0, Culture=neutral, PublicKeyToken=bb9a41a5e8aaa7e2]].MoveNext()
at TPL.Client.Shared.Layouts.Main.OnInitializedAsync()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
To make matters stranger this only happens in prod (azure app service). Locally, I don't get the error.
Sorry to throw these walls of text at you but I am at a loss on where to even begin here.
I am including a text file with all the above code, it's a bit more readable there. new 1.txt
Thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions