Trying to use `NativePtr.toVoidPtr` or `.ToPointer` causes `TypeLoadException`
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
**Repro steps**
Provide the steps required to reproduce the problem:
1. run code below
```fsharp
#nowarn "9"
open FSharp.NativeInterop
[]
let main argv =
let numbers = [| 1..10 |]
use v = fixed numbers
let v' = NativePtr.toVoidPtr v
printfn "void = %A" v'
0
```
[Project to reproduce the problem](https://github.com/dotnet/fsharp/files/5089306/repro.zip)
**Expected behavior**
`toVoidPtr` should just work and convert `nativeptr` to `voidptr`
**Actual behavior**
It throws this when run:
```
Unhandled exception. System.TypeLoadException: The generic type 'Microsoft.FSharp.Core.FSharpFunc`2' was used with an invalid instantiation in assembly 'FSharp.Core, Version=4.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
```
**Related information**
* Operating system: Linux and Windows (I tried both)
* .NET Core 3.1
* Visual Studio Code
Contributor guide
Assessment
This issue has not been assessed yet.