Null reference error in WebAssembly with reflection

The project to reproduce:
ErrorInReflection (1.6 MB)
The build log:
ErrorInReflection 1.bugreport.txt (21.1 KB)

When you run this code, it crashes withe the following error:

The code in the project is minimized to reproduce the error - in the original project, the same code is used to compile to .Net, and when compiled to .Net it works without problem.

Logged as bugs://E25866.

MyType.Name is nil. Checking why… hopefully just a bug in the reflection APIs.

Reproduced, this is all of Island, fields with Generic types cant get their types resolved./

  Public Veld9 As String()
  Public Veld8 As String
  Public Veld7 As Int32
  Public Veld5 As TestClass_Reflection

are all ok, only

  Public Veld6 As New List(Of String)

fails. FWIW<, from looking at your code (checking for []) you probably wanted an Array and not a List, anyways?

workaround for now? check if name (or type; I’ve fixed it so that unresolved types now return as nil rather than as a "bad’ Type instance) is nil and skip.

No, that is just a check to see if it is an array, because that needs a different flow than everything else.

The workaround for a generic won’t work, as I use the name to create a new instance of the type …
But for now, this fix (bad type fixed) will enable everything else to work.

It’ll work in that it won’t crash for generics, and will work for non-generics. For generics to work, you will have to wait for the proper fix I’m afraid, which I can’t do myself right now.

1 Like

bugs://E25866 was closed as fixed.