Open mgermano75 opened 2 years ago
Hello sir, My name is Kevin Comba, I'm using this web application using the latest blazor WebAssembly and trying to implement this project with the Microsoft graph SDK, but am stuck on the state management section.
warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100] Unhandled exception rendering component: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state. System.InvalidOperationException: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state. at Microsoft.AspNetCore.Components.Dispatcher.AssertAccess() at Microsoft.AspNetCore.Components.RenderTree.Renderer.AddToRenderQueue(Int32 componentId, RenderFragment renderFragment) at Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged() at BlazorSample.Components.EventsList.<OnInitialized>b__5_0() in C:\Users\Kevin Comba\Desktop\Graph & Dotnet\dotnet-blazor-server-app-microsoft-graph - Copy\Components\EventsList.razor:line 33 at BlazorSample.Components.AddEvent.AddEventToSelectedDay() in C:\Users\Kevin Comba\Desktop\Graph & Dotnet\dotnet-blazor-server-app-microsoft-graph - Copy\Components\AddEvent.razor:line 57 at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync() at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111] Unhandled exception in circuit '4j133JgqkgYEu5Nk-5XtgVUh4GQ5GHzAqxCuUP5sUaM'. System.InvalidOperationException: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state. at Microsoft.AspNetCore.Components.Dispatcher.AssertAccess() at Microsoft.AspNetCore.Components.RenderTree.Renderer.AddToRenderQueue(Int32 componentId, RenderFragment renderFragment) at Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged() at BlazorSample.Components.EventsList.<OnInitialized>b__5_0() in C:\Users\Kevin Comba\Desktop\Graph & Dotnet\dotnet-blazor-server-app-microsoft-graph - Copy\Components\EventsList.razor:line 33 at BlazorSample.Components.AddEvent.AddEventToSelectedDay() in C:\Users\Kevin Comba\Desktop\Graph & Dotnet\dotnet-blazor-server-app-microsoft-graph - Copy\Components\AddEvent.razor:line 57 at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.Forms.EditForm.HandleSubmitAsync() at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
. I think the error is on the event and how to invoke events while rerendering components. I'm new to blazor and dotnet in general an would love your support. Thank you
Hi @kelcho-spense
Thank you so much for reaching! Could you please share the @code section of your Blazor Component AddEvent.razor
I think it's a small issue, but need more context to be able to help with getting it resolved.
Thanks
Thank @aksoftware98 for your quick response. Below is my GitHub with your project code. I'm trying to use the latest Blazor WAS with Microsoft dotnet graph SDK.
Also I have worked around "Stuck on checking login state" . I have made sure only access the home page when your logged in. The graph sdk is managing the login state. Currently I am unable to refactor your code to use graph SDK on MicrosoftCalendarEventsProvider.cs service. I would love to hear your input on this. I'm just a beginner trying to learn.
Okay well, Here is the thing this code is very old, and I was new to Blazor and Blazor was new when I did it. I will go over it tomorrow and make sure to get it to work with the latest version and I will the branch and comment back here about it. Because this one is a little bit hard to follow compared to where Blazor is right now. I will comment here with the link to the new branch within the next 48 hours
Thanks bro this will be very helpful....looking forward to the update
Hello,
I made a clone of the software, and dotnet run worked like a charm; I can login using My Azure Account, and the message "Hello Marco" in the upper right corner is correctly displayed, so that apparently login was successful; still, the program is stuck on "Checking login state..." message
If I go to Home Section, and Select current year and month, the app displays "An unhandled error has occurred. [Reload]" message
Would it be possible to add the error message, so that we can some hints about the cause of failure ?
Thank you
Regards