Announcements icon indicating copy to clipboard operation
Announcements copied to clipboard

JSObjectReference has been made internal, and IJSObjectReference takes its place in the public API

Open MackinnonBuck opened this issue 5 years ago • 0 comments

JSObjectReference has been made internal, and IJSObjectReference takes its place in the public API

The new Microsoft.JSInterop.JSObjectReference and Microsoft.JSInterop.JSInProcessObjectReference types introduced in ASP.NET Core 5.0 RC 1 are being made internal, in favor of Microsoft.JSInterop.IJSObjectReference and Microsoft.JSInterop.IJSInProcessObjectReference which will be part of the public API in 5.0 RC 2.

Version introduced

ASP.NET Core 5.0 RC 2

Old behavior

A JSObjectReference could be obtained from a JS interop call via IJSRuntime. For example:

var jsObjectReference = await JSRuntime.InvokeAsync<JSObjectReference>(...);

New behavior

JSObjectReference will be made internal, so the new IJSObjectReference type must be used instead:

var jsObjectReference = await JSRuntime.InvokeAsync<IJSObjectReference>(...);

This also applies for JSInProcessObjectReference, which was replaced by IJSInProcessObjectReference.

Reason for change

The change makes this feature more consistent with other patterns within Blazor. IJSObjectReference is analogous to IJSRuntime in that it serves a similar purpose and has similar methods and extensions.

Recommended action

Replace all occurrences of JSObjectReference and JSInProcessObjectReference with IJSObjectReference and IJSInProcessObjectReference in your code.

Category

ASP.NET

Affected APIs

Microsoft.JSInterop.JSObjectReference Microsoft.JSInterop.JSInProcessObjectReference


Issue metadata

  • Issue type: breaking-change

MackinnonBuck avatar Sep 02 '20 22:09 MackinnonBuck