Objo.
Feedback Forum Docs Objo Studio
Feedback

Bug #131

Generic type parameter used as runtime type fails at runtime

Status
Fixed
Fixed in
v26.5.5
Source discussion
https://forum.objo.dev/d/60-returning-from-generic-is-bad
Last updated
2026-05-21

Public summary

Generic methods can be explicitly called with a concrete type argument, but using the type parameter as a runtime type inside the method fails at runtime. For example, a method declared as Function TestFunction(Of T)(s As String) As T is accepted when it returns New T() or uses TypeOf(T).CreateInstance(), and callers can write TestFunction(Of Person)(...). The program then crashes because T is erased and no runtime type named T exists.

Expected behaviour should be decided and implemented consistently: either generic type arguments should be available for runtime type operations such as TypeOf(T) / New T(), or these constructs should produce a clear compile-time diagnostic. The preferred fix is to properly support runtime type tokens for generic parameters.

Objo.

Build apps visually, deploy anywhere.

Feedback is a public read-only status mirror for Objo Studio.