Skip to content

Reflection unreliable in wasm #1072

Closed
Closed

Description

@peternary

Current behavior

Reflection does not reliably discover static properties on static classes in wasm. Type.GetProperty, for instance, only seems to be able to find a property if that property is referenced explicitly somewhere in code.

Expected behavior

Reflection should work as it does in UWP environment.

How to reproduce it (as minimally and precisely as possible)

WasmReflection.zip

In wasm this attempts to read all properties from a static class, but returns none. Another reflection example using another class works as expected. Reflection in both cases works as expected when in UWP.

Environment

Nuget Package:
Uno.UI
Package Version(s):
1.45.0-dev.1813
Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • Windows
  • Build tasks

Visual Studio

  • 2017 (version: )
  • 2019 (version: )
  • for Mac (version: )

Relevant plugins

  • Resharper (version: )

Anything else we need to know?

Activity

  1. jeromelaban commented on Jun 14, 2019

    @jeromelaban
    Member

    This is not a reliability issue, this is related to the use of a linker. You can use the linker settings file to control this behavior. Also, UWP has the same issue when .NET Native is used.

  2. peternary commented on Jun 14, 2019

    @peternary
    Author

    Hey, that did the trick.

  3. added 3 commits that reference this issue on Mar 28, 2025
  4. added a commit that references this issue on Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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