Using voidptr as a type argument does not cause a compiler error, even though it is invalid and causes a BadImageFormatException or TypeLoadException at runtime.
Repro steps
- Use
voidptr as a type argument, e.g:
let badList: voidptr list = []
printf "%A" badList
- Compile.
Expected behavior
An error, preventing compilation. This happens in C# with void*.
Actual behavior
No compilation error, but errors at runtime.
Known workarounds
Don't try to use voidptr as a generic type argument.
Related information
- Operating system: Kubuntu 25.10
- .NET Runtime kind: .NET 10
- Editing Tools: JetBrains Rider 2025.3.1
Using
voidptras a type argument does not cause a compiler error, even though it is invalid and causes aBadImageFormatExceptionorTypeLoadExceptionat runtime.Repro steps
voidptras a type argument, e.g:Expected behavior
An error, preventing compilation. This happens in C# with
void*.Actual behavior
No compilation error, but errors at runtime.
Known workarounds
Don't try to use
voidptras a generic type argument.Related information