Skip to content

[Breaking change]: Legacy Mono and Emscripten JavaScript APIs are not exported to global namespace in Blazor WebAssembly applications #516

@maraf

Description

@maraf

Description

In previous versions of Blazor WebAssembly, legacy Mono and Emscripten APIs were exported to global namespace.
From 9.0 those APIs are accessible throught Blazor.runtime object.

Version

.NET 9 GA

Previous behavior

Legacy Mono (MONO, BINDING) and Emscripten Module object was exported to global window object.
For example window.Module.FS returned emscripten virtual filesystem.

New behavior

Emscripten Module object is now exported to Blazor.runtime object.
For example Blazor.runtime.Module.FS returns emscripten virtual filesystem.
Legacy Mono API for interop was removed completely (MONO and BINDING) and replaced with JSImport/JSExport.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
  • Behavioral change: Existing binaries may behave differently at run time.

Reason for change

The general goal is not to polute global namespace and keep all the APIs accessible from single Blazor object.

Recommended action

Replace accessing Emscripten APIs from window object to Blazor.runtime object.

Affected APIs

window.MONO.*
window.BINDING.*
window.Module.*

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking 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