Hi,
I'm using the Scheduler component with a UrlAdaptor DataManager to fetch schedule data from my API.
I can see the request correctly hitting my controller and returning the correct payload, which is then rendered on the calendar correctly. However if I try to change the month/date/view the application throws the following exception:
Unhandled exception rendering component: This JsonSerializerOptions instance is read-only or has already been used in serialization or deserialization.
I've replicated this in a dotnet 8 project with the Blazor Web App project template using wasm interactive mode, using code from documentation.
Any help would be appreciated, sorry if I've just missed something!
Full exception:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: This JsonSerializerOptions instance is read-only or has already been used in serialization or deserialization.
System.InvalidOperationException: This JsonSerializerOptions instance is read-only or has already been used in serialization or deserialization.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_SerializerOptionsReadOnly(JsonSerializerContext context)
at System.Text.Json.JsonSerializerOptions.VerifyMutable()
at System.Text.Json.JsonSerializerOptions.ConverterList.OnCollectionModifying()
at System.Text.Json.Serialization.ConfigurationList`1[[System.Text.Json.Serialization.JsonConverter, System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].Add(JsonConverter item)
at Syncfusion.Blazor.Data.HttpHandler.PrepareRequest(RequestOptions options)
at Syncfusion.Blazor.DataManager.<ExecuteQuery>d__156`1[[SchedulerTest.Client.Pages.Counter.AppointmentData, SchedulerTest.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Syncfusion.Blazor.DataManager.<ExecuteQuery>d__154`1[[SchedulerTest.Client.Pages.Counter.AppointmentData, SchedulerTest.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Syncfusion.Blazor.Schedule.Internal.EventBase`1.<RefreshDataManager>d__24[[SchedulerTest.Client.Pages.Counter.AppointmentData, SchedulerTest.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Syncfusion.Blazor.Schedule.Internal.EventBase`1.<RefreshDataManager>d__24[[SchedulerTest.Client.Pages.Counter.AppointmentData, SchedulerTest.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Syncfusion.Blazor.Schedule.Internal.VerticalView`1.<OnParametersSetAsync>d__69[[SchedulerTest.Client.Pages.Counter.AppointmentData, SchedulerTest.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Hi Dan,
Greetings from Syncfusion.
Before proceeding further with your requirement. kindly share us the below details from your end.
The above requested details will be very helpful for us to validate your requirement.
Regards,
Monisha
Hi,
Thanks for the response.
I'm using version 23.2.6 of the Nuget libraries, this is the first time I've used the scheduler component so I've not ever had a working version.
I've pushed a reproduceable sample to this repository: https://github.com/Ditchboo/SchedulerTest
The DataManager should make a post request to the simple "SchedulerController" which just returns a hardcoded event. You should see this event is shown correctly on the scheduler but if you try to change date then the JsonSerializerOptions exception is thrown.
I'm basing my example on the documentation here. Hope that helps, please let me know if you need any more information.
Hi Dan,
Sample: https://github.com/SyncfusionExamples/blazor-scheduler-crud-using-url-adaptor
We have tried to replicate the mentioned issue by running the sample you provided, but we were unable to find any controller codes for the CRUD actions you used in the URL adaptor for the scheduler. Could you please share a runnable sample so that we can validate further? For your reference, we have shared a runnable sample of the URL adaptor. Kindly check that, as it might help you identify the cause and resolve the issue or try to replicate the issue in the shared sample.
Regards,
Venkatesh
Hi,
Thanks for the sample, I've update my example of the issue in the repository here: https://github.com/Ditchboo/SchedulerTest this now includes the in-memory datastore and controller methods as per the sample code.
This example should run showing 2 events on the calendar, if you try to change dates then the JsonSerializerOptions exception is thrown.
Hope that helps.
Thanks,
Dan
Dan,
We are unable to run the sample you provided in the given repository and are encountering errors (The program '' has exited with code 4294967295 (0xffffffff). The program '[31600] SchedulerTest.exe' has exited with code 4294967295 (0xffffffff)). Therefore, could you please guide us on resolving the issue and running the sample? Alternatively, if you could reproduce the issue in our shared sample where we have not faced the mentioned issue on navigating through the views, it would help us validate further and provide a proper solution.
Hi,
Sorry that the sample isn't working for you.
I've recreated the issue on your shared sample by updating the Syncfusion NuGet packages to their latest versions.
<PackageReference Include="Syncfusion.Blazor.Data" Version="23.2.7" />
<PackageReference Include="Syncfusion.Blazor.Schedule" Version="23.2.7" />
<PackageReference Include="Syncfusion.Blazor.Themes" Version="23.2.7" />
I've pushed this to a fork of the sample repository here.
Thanks,
Dan
Dan,
We have already confirmed the problem you reported regarding "Unhandled
exception rendering component: This JsonSerializerOptions instance is read-only
or has already been used in serialization or deserialization" as a bug
and have logged a defect report. The fix for this defect will be included in
our upcoming Volume 4 release, which is expected to be rolled out on December
18, 2023. You can track the status of the fix using the following link.
Feedback: https://www.syncfusion.com/feedback/49182/exception-throws-while-performing-crud-operation-in-odatav4
Regards,
Venkatesh
Hi Dan,
We are glad to announce that our Essential Studio 2023 Volume 4 release v24.1.41 is rolled out and is available for download under the following link.
The fix for the issue “Unhandled exception rendering component: This JsonSerializerOptions instance is read-only or has already been used in serialization or deserialization” has been included in our volume 4 release v24.1.41. Upgrade to the latest version to resolve the issue.
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
Regards,
Satheesh
Thank you, tested and working in this release.