You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today whenever a type is cross library boundary we fall back to JsonSerializer and expect the other library to have implemented a JsonConverter to support this. Before MRW this was our only way to support public serialization / deserialization.
With MRW we can do things slightly differently.
All calls to JsonSerializer.Serializer where the target is an IJsonModel should be updated to
((IJsonModel<T>)Property).Write(writer,options);
For calls to JsonSerializer.Deserializer where the target is an IJsonModel we will need to add a new helper in ModelSerializationExtension.
//ModelSerializationExtensionprivatereadonlystaticJsonSerializerOptionss_options=new(){Converters={newJsonModelConverter(ModelSerializationExtensions.WireOptions,AzureResourceManagerCosmosDBContext.Default)}};[UnconditionalSuppressMessage("Trimming","IL2026",Justification="By passing in the JsonSerializerOptions with a reference to AzureResourceManagerCosmosDBContext.Default we are certain there is no AOT compat issue.")][UnconditionalSuppressMessage("Trimming","IL3050",Justification="By passing in the JsonSerializerOptions with a reference to AzureResourceManagerCosmosDBContext.Default we are certain there is no AOT compat issue.")]publicstaticTJsonDeserialize<T>(JsonPropertyproperty,ModelReaderWriterOptionsoptions){returnJsonSerializer.Deserialize<T>(property.Value.GetRawText(),s_options);}
With this new internal helper in place we can change the calls to
JsonDeserialize<T>(property,options);
This will ensure AOT compatibility for cross library boundary serialization and deserialization.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Related to Azure/azure-sdk-for-net#50279 and Azure/azure-sdk-for-net#50129
Today whenever a type is cross library boundary we fall back to JsonSerializer and expect the other library to have implemented a JsonConverter to support this. Before MRW this was our only way to support public serialization / deserialization.
With MRW we can do things slightly differently.
All calls to JsonSerializer.Serializer where the target is an IJsonModel should be updated to
For calls to JsonSerializer.Deserializer where the target is an IJsonModel we will need to add a new helper in ModelSerializationExtension.
With this new internal helper in place we can change the calls to
This will ensure AOT compatibility for cross library boundary serialization and deserialization.
The text was updated successfully, but these errors were encountered: