[Discussion]: Breaking changes to Microsoft.JSInterop #10810
Labels
area-blazor
Includes: Blazor, Razor Components
breaking-change
This issue / pr will introduce a breaking change, when resolved / merged.
Milestone
In 3.0-preview6, we're migrating Microsoft.JSInterop to use the System.Text.Json based serializer. As part of this transition, there are several breaking changes to the JSInterop library:
Microsoft.JSInterop.Json
is being removed. Users may use a JSON serializer of their choice. We recommend using theSystem.Text.Json
-based serializer since Blazor already references it. Here's the code change required to migrate to useSystem.Text.Json
:DotNetObjectRef
is replaced by a genericDotNetObjectRef<T>
that is required for both sending and receiving a managed object reference when doing interop with the browserMicrosoft.JSInterop will use System.Text.Json to marshal interop data. To customize serialization, you may use serialization primitives such as
JsonPropertyNameAttribute
,JsonIgnoreAttribute
etc.IJSRuntime.UntrackObjectRef(DotNetObjectRef);
has been removed. To stop tracking an object reference, dispose theDotNetObjectRef<T>
instance either on the server or the client.The text was updated successfully, but these errors were encountered: