Getting console error as System.InvalidOperationException: The render handle is not yet assigned. while configure MVVM
Microsoft.AspNetCore.Components.Web.Rendering.RemoteRenderer: Warning: Unhandled exception rendering component: The render handle is not yet assigned.
System.InvalidOperationException: The render handle is not yet assigned.
at Microsoft.AspNetCore.Components.RenderHandle.ThrowNotInitialized()
at Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged()
at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, Object arg)
at Microsoft.AspNetCore.Components.Rendering.Renderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, UIEventArgs eventArgs)
Microsoft.AspNetCore.Components.Server.ComponentHub: Warning: Unhandled exception in circuit CfDJ8IDx4QRl8tJJi60Rm1blqWaE0f75XyR1UnbCJlq37gYkjs_O7ND0dvBw5G6DsxVQ0UmmAXbq3qtZwGqO_niwlZ3sgYLaCAAADLNKj8E7kFNBkgkrnFe7YFjd0QjGSYd9RWQRb3JUzSrT1eTTK6oWlHppTtWoFaL5QHA_70lZpsQ0
System.InvalidOperationException: The render handle is not yet assigned.
at Microsoft.AspNetCore.Components.RenderHandle.ThrowNotInitialized()
at Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged()
at Microsoft.AspNetCore.Components.ComponentBase.Microsoft.AspNetCore.Components.IHandleEvent.HandleEventAsync(EventCallbackWorkItem callback, Object arg)
at Microsoft.AspNetCore.Components.Rendering.Renderer.DispatchEventAsync(UInt64 eventHandlerId, EventFieldInfo fieldInfo, UIEventArgs eventArgs)
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint '/_blazor'
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 9111.062600000001ms 101
dotnet info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview8-013656
Commit: 8bf06ffc8d
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x86
Base Path: C:\Program Files (x86)\dotnet\sdk\3.0.100-preview8-013656\
Host (useful for support):
Version: 3.0.0-preview8-28405-07
Commit: d01b2fb7bc
.NET Core SDKs installed:
2.2.401 [C:\Program Files (x86)\dotnet\sdk]
3.0.100-preview8-013656 [C:\Program Files (x86)\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview8-28405-07 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview8-28405-07 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
Sample to validate the issue
DialogExample_23a457ae.zip
Is there a reason your view model derives from ComponentBase:
```C#
public class LoginViewModel : BaseViewModel
public abstract class BaseViewModel : ComponentBase
{
[Inject]
protected IUriHelper UriHelper { get; set; }
}
```
It's never initialized by Blazor, which explains the stack trace you're seeing when it's handling an event.
Hi @pranavkm ,
How to resolve that issue? can you guide me to fix this issue?
Thanks in advance
Pandiyaraj M
Changing the view model to stop deriving from ComponentBase should resolve the issue.
I have changed as you suggest solution, still issue occur
Thank you for contacting us. Due to no activity on this issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue.