Skip to content

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

@MackinnonBuck

Description

@MackinnonBuck

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    5.0.0Announcements related to ASP.NET Core 5.0AnnouncementBreaking changeDocumentedThe breaking change has been published to the .NET Core docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions