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
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:
The helper type Microsoft.JSInterop.Json is being removed. Users may use a JSON serializer of their choice. We recommend using the System.Text.Json-based serializer since Blazor already references it. Here's the code change required to migrate to use System.Text.Json:
DotNetObjectRef is replaced by a generic DotNetObjectRef<T> that is required for both sending and receiving a managed object reference when doing interop with the browser
// Before
IJSRuntime.InvokeAsync("SomeJSMethod",new DotNetObjectRef(someObject));[JSInvokable]publicstatic Task SomeDotNetMethod(MyObjectmyObject){
...}// After
IJSRuntime.InvokeAsync("SomeMethod", DotNetObjectRef.Create(someObject));[JSInvokable]publicstatic Task SomeDotNetMethod(DotNetObjectRef<MyObject>myObject){
...}
Microsoft.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 the DotNetObjectRef<T> instance either on the server or the client.
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.Please use dotnet/aspnetcore#10810 for further discussions.
The text was updated successfully, but these errors were encountered: