Unxepected character encountered when parsing value: M. Path '', line 0, path 0

I have a Grid component that whenever I add a row manually, I get the following error:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Unexpected character encountered while parsing value: M. Path '', line 0, position 0. Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: M. Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue() at Newtonsoft.Json.JsonTextReader.Read() at Newtonsoft.Json.JsonReader.ReadAndMoveToContent() at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Syncfusion.Blazor.Internal.SfBaseUtils.ChangeType(Object dataValue, Type conversionType, Boolean isClientChange, Boolean isParseValue) at Syncfusion.Blazor.DropDowns.SfDropDownBase`1[[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].SetItemValue(String itemValue, Type valueType) at Syncfusion.Blazor.DropDowns.SfComboBox`2.d__51[[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() at Syncfusion.Blazor.DropDowns.SfDropDownList`2.d__433[[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() at Syncfusion.Blazor.DropDowns.SfDropDownList`2.d__432[[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() at Syncfusion.Blazor.DropDowns.SfComboBox`2.d__41[[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() at Syncfusion.Blazor.DropDowns.SfAutoComplete`2.d__48[[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[MilGearsX.Models.ServiceHistory.Uic, MilGearsX.Models, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)​


I have not been able to find any info online or otherwise that points to why this error is occurring. I have also tried debugging the component with no luck. I have attached the file in question, any help would be appreciated.


Attachment: SF_Grid_Parsing_Error_1ca5ef7d.zip

6 Replies

VN Vignesh Natarajan Syncfusion Team November 23, 2021 02:31 PM UTC

Hi Dylan,  
 
Thanks for contacting Syncfusion support.  
 
Query: “I have a Grid component that whenever I add a row manually 
 
Before proceeding further, we need some more details about the issue you are facing. So kindly share the following details.  
 
  1. Share your Syncfusion Blazor NuGet version details.
  2. Share the details about the application framework (i.e.) .Net Core 3.0, 5.0 or 6.0.
  3. Are you facing the issue after upgrading to our latest version  only?
  4. Adding the row manually means are you facing issue while clicking the Add toolbar button or AddRecordAsync method?
 
Above requested details will be very helpful for us to validate the reported query at our end and provide solution as early as possible.  
 
Regards, 
Vignesh Natarajan 



DD Dylan Davenport November 24, 2021 02:37 PM UTC

Hi Vignesh, thank you for your response. Below is the information you requested.


  1. Share your Syncfusion Blazor NuGet version details.
    Currently using SyncFusion Blazor version 19.3.0.53
  2. Share the details about the application framework (i.e.) .Net Core 3.0, 5.0 or 6.0.
    Using .Net 5
  3. Are you facing the issue after upgrading to our latest version  only?
    I had this issue with version 19.3.0.44 so I upgraded to version 19.3.0.53 and have the same issue.
  4. Adding the row manually means are you facing issue while clicking the Add toolbar button or AddRecordAsync method?
    Yes, when I click the Add button a row is manually added and I get the error mentioned above.


VN Vignesh Natarajan Syncfusion Team November 25, 2021 12:50 PM UTC

Hi Dylan,  
 
Thanks for sharing the requested details.  
 
Query: “Unxepected character encountered when parsing value: M. Path '', line 0, path 0 
 
We are able to reproduce the reported issue at our end also and issue occur due to AutoComplete component defined for Uic column. Currently we are validating the reported issue at our end and we need some more time to analyze the issue. we will update you the further details in two business days (29th November 2021).  
 
We appreciate your patience until then.  
 
Regards, 
Vignesh Natarajan 



BC Berly Christopher Syncfusion Team November 29, 2021 12:09 PM UTC

Hi Dylan, 

We have validated the reported query and we are able to reproduce the reported issue at our end also. This is because, empty instance of Uic object is defined as a value to AutoComplete while inserting a record. To overcome the reported issue, we suggest you to define the value as null when both the objects of Uic where null in the EditTemplate’s context value.   
  
 Refer the below code example.   
  
<EditTemplate>  
     @{  
         ServiceAssignment serviceAssignment = (context as ServiceAssignment);  
         if (serviceAssignment.Uic.Code == null)  
         {  
             serviceAssignment.Uic = null;  
         }  
         string personnelCategory = serviceAssignment.PersonnelCategory?.Code;  
     }  
     <SfAutoComplete PopupWidth="320px"  
                     Placeholder="---"  
                     @ref="UicDropDownlistRef"  
                     TItem="Uic"  
                     TValue="Uic"  
                     MinLength="3"  
                     Value="serviceAssignment.Uic"  
                     OnInput="UicCodeChangeHandler"  
                     DataSource="uics"  
                     ValueChanged="uic=>serviceAssignment.Uic = uic ?? serviceAssignment.Uic"  
                     AllowFiltering="true">  
         <AutoCompleteTemplates TItem="Uic">  
             <ItemTemplate Context="itemContext">  
                 @{  
                     Uic sa = (itemContext as Uic);  
                 }  
                 @if (!(string.IsNullOrEmpty(sa.Title) || string.IsNullOrEmpty(sa.Code)))  
                 {  
                     <span>@(sa.Code + " - " + sa.Title)</span>  
                 }  
                 else if (string.IsNullOrEmpty(sa.Title))  
                 {  
                     <span>@sa.Code</span>  
                 }  
                 else if (string.IsNullOrEmpty(sa.Code))  
                 {  
                     <span>@sa.Title</span>  
                 }  
             </ItemTemplate>  
         </AutoCompleteTemplates>  
         <AutoCompleteEvents TItem="Uic" TValue="Uic" OnOpen="StateHasChanged" ValueChange=StateHasChanged Filtering="OnUicFilter" />  
         <AutoCompleteFieldSettings Text="Title" Value="Code" />  
     </SfAutoComplete>  
 </EditTemplate>  
  
 
   
  
We have ensured the reported solution with the Grid component and we are able to resolve the reported issue at our end.    
  
Please let us know if you have further queries.   

Regards, 
Berly B.C 



DD Dylan Davenport replied to Berly Christopher November 29, 2021 04:48 PM UTC

Thanks for the reply Berly, your solution fixed my problem! I only had to make one small change which was to add a couple of null conditional operators to account for any null reference exceptions (see code sample below). Once I did that, I was good to go, thanks again!


if (serviceAssignment?.Uic?.Code == null) 

    serviceAssignment.Uic = null; 
}


BC Berly Christopher Syncfusion Team November 30, 2021 05:50 AM UTC

Hi Dylan Davenport, 
  
We are glad to know that the issue is resolved in your end. Please get back to us if you need further assistance on this. 
  
Regards, 
Berly B.C 


Loader.
Up arrow icon