You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HR][Gaps][HD][Navigation] InvalidCastException after HR when navigating via code behind #2903
After adding a call to NavigateViewModelAsync in a ViewModel and triggering HR the following exception is thrown :
System.InvalidCastException: 'Unable to cast object of type 'Chefs.Presentation.LoginModel#1' to type 'Chefs.Presentation.LoginModel'.'
but if I continue HR is successful and navigation also works as expected.
Stack:
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast object of type 'Chefs.Presentation.LoginModel#1' to type 'Chefs.Presentation.LoginModel'.
Source=System.Private.CoreLib
StackTrace:
at System.Runtime.CompilerServices.CastHelpers.ChkCast_Helper(Void* toTypeHnd, Object obj)
at Chefs.Presentation.LoginViewModel.get_Model() in D:\source\uno.chefs\Chefs\obj\Debug\net9.0-desktop\Uno.Extensions.Reactive.Generator\Uno.Extensions.Reactive.Generator.FeedsGenerator\Chefs.Presentation.LoginModel.Bindable.g.cs:line 350
at Chefs.Presentation.LoginViewModel.get_Login() in D:\source\uno.chefs\Chefs\obj\Debug\net9.0-desktop\Uno.Extensions.Reactive.Generator\Uno.Extensions.Reactive.Generator.FeedsGenerator\Chefs.Presentation.LoginModel.Bindable.g.cs:line 375
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Expected behavior
How to reproduce it (as minimally and precisely as possible)
For a recommended app remove the call await _navigator.NavigateViewModelAsync<SecondModel>(this, data: new Entity(name!)); from the MainModel.
changed the title [-][HR][Navigation] InvalidCastException after HR[/-][+][HR][Navigation] InvalidCastException after HR when navigating via code behind[/+]on Oct 6, 2025
changed the title [-][HR][Navigation] InvalidCastException after HR when navigating via code behind[/-][+][HR][HD][gaps] [Navigation] InvalidCastException after HR when navigating via code behind[/+]on Nov 25, 2025
changed the title [-][HR][HD][gaps] [Navigation] InvalidCastException after HR when navigating via code behind[/-][+][Gaps][HR][HD] [Navigation] InvalidCastException after HR when navigating via code behind[/+]on Nov 25, 2025
changed the title [-][Gaps][HR][HD] [Navigation] InvalidCastException after HR when navigating via code behind[/-][+][HR][Gaps][HD][Navigation] InvalidCastException after HR when navigating via code behind[/+]on Nov 25, 2025
Activity
[-][HR][Navigation] InvalidCastException after HR[/-][+][HR][Navigation] InvalidCastException after HR when navigating via code behind[/+]Jen-Uno commentedon Oct 29, 2025
@Kunal22shah can we have the stack trace, please?
Kunal22shah commentedon Oct 29, 2025
@Jen-Uno updated the issue with the stack.
[-][HR][Navigation] InvalidCastException after HR when navigating via code behind[/-][+][HR][HD][gaps] [Navigation] InvalidCastException after HR when navigating via code behind[/+][-][HR][HD][gaps] [Navigation] InvalidCastException after HR when navigating via code behind[/-][+][Gaps][HR][HD] [Navigation] InvalidCastException after HR when navigating via code behind[/+][-][Gaps][HR][HD] [Navigation] InvalidCastException after HR when navigating via code behind[/-][+][HR][Gaps][HD][Navigation] InvalidCastException after HR when navigating via code behind[/+]DevTKSS commentedon Dec 5, 2025
@Kunal22shah I expirience something very similar using x:Bind in the UI Layer with HR. Would you check if this might be the same issue source?
refactor(test): rewrite HR tests to use actual HotReloadHelper.Update…
refactor(test): rewrite HR tests to use actual HotReloadHelper.Update…
refactor(test): rewrite HR tests to use actual HotReloadHelper.Update…