Skip to content

Blazor WebAssembly - handle unsupported properties properly #280

Closed
@rose-a

Description

@rose-a

In #274 we've added a workaround for unsupported properties in WASM which swallows the PlatformNotSupported exceptions.
We should add proper guards to avoid execution this part of the code completely when running on WebAssembly.

@bjorg, I've found this answer in a GitHub issue on "detecting if the code runs in WASM".

Could you please try if RuntimeInformation.IsOSPlatform(OSPlatform.Create("WEBASSEMBLY")) correctly detects your code running in WebAssembly? This way we could purposely avoid accessing these properties without swallowing exceptions...

Seems that from .NET 5 on we'll get a OperatingSystem.IsBrowser() method to do just this, according to this article...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions