Repository navigation
Description
This issue has been moved from a ticket on Developer Community.
[severity:It's more difficult to complete my work]
Please see the attached csproj file.
It is a very basic Blazor project that utilizes a Syncfusion control. This control works in . NET6 preview-7 but throws the following exception in rc1 and the rc2 build available today:
System.InvalidOperationException: The converter specified on 'Syncfusion.Blazor.Grids.GridColumn.EditTemplate' does not derive from JsonConverter or have a public parameterless constructor.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_SerializationConverterOnAttributeInvalid(Type classType, MemberInfo memberInfo)
at System.Text.Json.JsonSerializerOptions.GetConverterFromAttribute(JsonConverterAttribute converterAttribute, Type typeToConvert, Type classTypeAttributeIsOn, MemberInfo memberInfo)
at System.Text.Json.JsonSerializerOptions.DetermineConverter(Type parentClassType, Type runtimePropertyType, MemberInfo memberInfo)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo.GetConverter(Type type, Type parentClassType, MemberInfo memberInfo, Type& runtimeType, JsonSerializerOptions options)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo.AddProperty(MemberInfo memberInfo, Type memberType, Type parentClassType, Boolean isVirtual, Nullable`1 parentTypeNumberHandling, JsonSerializerOptions options)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo.CacheMember(Type declaringType, Type memberType, MemberInfo memberInfo, Boolean isVirtual, Nullable`1 typeNumberHandling, Boolean& propertyOrderSpecified, Dictionary`2& ignoredMembers)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo.. ctor(Type type, JsonConverter converter, Type runtimeType, JsonSerializerOptions options)
at System.Text.Json.JsonSerializerOptions. <InitializeForReflectionSerializer>g__CreateJsonTypeInfo|112_0(Type type, JsonSerializerOptions options)
at System.Text.Json.JsonSerializerOptions.GetClassFromContextOrCreate(Type type)
at System.Text.Json.JsonSerializerOptions.GetOrAddClass(Type type)
at System.Text.Json.Serialization.Metadata.JsonTypeInfo.get_ElementTypeInfo()
at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.TryWriteAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Converters.DictionaryDefaultConverter`3.OnWriteResume(Utf8JsonWriter writer, TDictionary value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonDictionaryConverter`3.OnTryWrite(Utf8JsonWriter writer, TDictionary dictionary, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.JsonSerializer.WriteUsingSerializer[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.WriteStringUsingSerializer[TValue](TValue& value, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options)
at Syncfusion.Blazor.Grids.SfGrid`1.SerializeModel(SfGrid`1 comp)
at Syncfusion.Blazor.Grids.SfGrid`1.OnAfterRenderAsync(Boolean firstRender)
Again this works on 6.0.100-preview.7.21379.14 but not on 6.0.100-rc.1.21416.1 or 6.0.100-rc.2.21420.30.
I have attached a recording of the exception occurring.
Original Comments
Feedback Bot on 8/23/2021, 01:57 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
DragonSpark on 8/23/2021, 04:14 AM:
FWIW this is also being tracked on Syncfusion’s side here:
https://www.syncfusion.com/feedback/28117/serialization-exception-throws-in-sfgrid-while-upgrading-to-latest-net-version
Original Solutions
(no solutions)
Activity
eiriktsarpalis commentedon Sep 7, 2021
The exception message:
Seems to provide a clear suggestion on what is causing the error. Not discounting the possibility of this being a regression, however we would need to see a reproducing app to better understand the nature of the error.
Mike-E-angelo commentedon Sep 7, 2021
Hi @eiriktsarpalis thank you for your investigation of this issue. As stated in the ticket a csproj was provided and attached. You may also find the same project here for your review:
https://github.com/Mike-E-angelo/Stash/tree/master/Syncfusion.Error/WebApplication1
Please do let me know if you require any further information and I will do my best to assist. 👍
eiriktsarpalis commentedon Sep 7, 2021
Thanks, we'll investigate.
eiriktsarpalis commentedon Sep 8, 2021
I can reproduce the issue locally. As the error message suggests, this is an issue with the syncfusion components. The
Syncfusion.Blazor.Grids.GridColumn.EditTemplateproperty has aSystem.Text.Json.Serialization.JsonConverterAttributethat specifies aTemplateConverterconverter that derives fromNewtonsoft.Json.JsonConverterinstead ofSystem.Text.Json.JsonConverter. This should explain the error message.I would recommend filing an issue with the maintainers of syncfusion.
Mike-E-angelo commentedon Sep 8, 2021
That was my impression as well @eiriktsarpalis. As stated in a comment on the developercommunity ticket this has been reported to Syncfusion as well.
However, the confusing part to me is that this works if you switch to preview-7. Why does it work in preview-7 and not RC1?
eiriktsarpalis commentedon Sep 8, 2021
Are you sure no other moving parts have come into play? The particular syncfusion converter is clearly broken and would fail with this error in all releases of System.Text.Json.
Mike-E-angelo commentedon Sep 8, 2021
Try switching to preview7 on your side and watch the magic, @eiriktsarpalis. :)
I was able to get it to work/break simply by switching between the two SDKs. In fact, Syncfusion couldn't reproduce it on their side when I initially reported it to them. It wasn't until I switched back to preview7 that it worked as they saw it as well. If you follow the thread there I requested they try RC1 and that is when they filed the bug on their end.
This is definitely a versioning regression, and I agree with your conclusion on what is wrong, but I am still unclear on why this worked in preview7 (and
net5.0as well).16 remaining items
mayur-ekbote commentedon Sep 15, 2021
@eiriktsarpalis Did you get a chance to test it between .net 6 previews vs RC1? Specifically, was this JsonIgnore behavior introduced in RC1?
eiriktsarpalis commentedon Sep 16, 2021
Culprit seems to be this change: 91021fe#diff-814722ef5303e65815d350762206450b283510f6246b658047c4dffd31c97920L59-L64
@layomia could you take a look? Not sure why order was swapped. Should we consider reverting for .NET 6?
layomia commentedon Sep 16, 2021
The order was swapped for infrastructural reasons to support the src-gen parameterized ctor feature. I'll investigate a fix for the regression here. I do hope that the maintainers of Syncfusion can address the converter misconfiguration issue in the event that this doesn't meet the bar for a 6.0 fix.
Mike-E-angelo commentedon Sep 16, 2021
FWIW my concern is not only for Syncfusion but others who may be in employing the same method in their serialization(s) as well. It will break for them too once they onboard to RC1+. If it is documented under breaking changes somewhere then I am OK with that as well. But that's just my vote/take/preference.
mayur-ekbote commentedon Sep 17, 2021
Devs might be using [JsonIgnore] like the left-hand operand of && that always evaluates to a fixed value. Possibly to postpone making more structural changes when .net moved from newtonsoft to system.text in 3.1 (clearly the case with Syncfusion).
This will introduce runtime-breaking changes that might go unnoticed for a while. Unlike some other breaking changes that impact a startup-config or EF core (entirely in the domain of the app developer to fix), this change will affect libraries that would be completely out of the control of the developer. Till the 3rd parties (and their transitive dependents) fix this, the developer won't be able to migrate to .net 6. There is a lot riding on .net 6: MAUI, hot reload, blazor mobile bindings, and so on.
Since it is breaking the [JsonIgnore] contracts of prior versions, it would be futile to keep it on the roadmap for .net 7. If it is not fixed in .net 6, the workaround would have been implemented by the time .net 7 arrives.
I hope a wider consultation is held before any call is made on this issue.
eiriktsarpalis commentedon Sep 20, 2021
Triage: reverting the change in 91021fe#diff-814722ef5303e65815d350762206450b283510f6246b658047c4dffd31c97920L59-L64 at this stage carries risk and it does not meet the bar for servicing RC2. Reported issue is due to a bug in a third-party library which depended on undefined behavior in System.Text.Json: its maintainers are already working on a fix.
I have created #59364 to track making
JsonIgnoreAttributesemantics well-documented and consistent in a future release of System.Text.Json.Mike-E-angelo commentedon Sep 20, 2021
Works for me, @eiriktsarpalis. Thank you for all your efforts out there, both to you and your team. 🙏
rajendranr-5483 commentedon Sep 27, 2021
Hi @eiriktsarpalis / @Mike-E-angelo,
I work for Syncfusion. We have faced serialization issue with DataGrid, TreeGrid and Toolbar components alone when migrating from .NET 6 Preview 7 to .NET 6 RC1. Since, we have used TemplateConverter in these components. We have resolved the compatibility related issues and included with 2021 Volume 3 release, which is ready to roll-out within this week.
Currently, we are compiling our Blazor source using netstandard 2.1 and net 5.0. We planned to compile our source using .NET 6 Target from upcoming 2021 Volume 4 releases.
timkempster commentedon Sep 28, 2021
Thanks for the update rajendranr-5483. Please can you post here when you have released so we can give it a spin. I'm really suffering with this one. I tried to go back to a downgrade but it casued all sorts of other issues so I'm stuck waiting for Synchfusion before I can continue to work in any meaningful way.
rajendranr-5483 commentedon Sep 28, 2021
@timkempster ,
Sure, we have planned to roll-out the 2021 Volume 3 release on or before 1st October.
I will update here once release will be rolled-out.
rajendranr-5483 commentedon Sep 30, 2021
@TimLovellSmith,
We have rolled the 2021 Volume 3 release by today.
https://www.syncfusion.com/forums/169291/essential-studio-2021-volume-3-main-release-v19-3-0-43-is-available-for-download
Release notes - https://blazor.syncfusion.com/documentation/release-notes/19.3.43?type=all#common
Mike-E-angelo commentedon Sep 30, 2021
I can confirm that I have working
SfGrid's again! Thank you all!https://www.nuget.org/packages/Syncfusion.Blazor/19.3.0.43