-
Notifications
You must be signed in to change notification settings - Fork 854
Open
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingArea-Compiler-Checking-Byrefbyref, inref, outref, byref-like types, NativePtr, function pointers, struct semanticsbyref, inref, outref, byref-like types, NativePtr, function pointers, struct semanticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Description
Trying to use a field with function pointer type throws a MissingFieldException in runtime.
Repro steps
Provide the steps required to reproduce the problem:
- Create a new F# console app
- Add TerraFx.Interop.Windows package
<ItemGroup>
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.20348" />
</ItemGroup>- Use the following code:
open TerraFX.Interop.Windows
let mutable windowClassDescriptor = WNDCLASSEXW()
windowClassDescriptor.lpfnWndProc <- 0n // lpfnWndProc is of type delegate* unmanaged<HWND, uint, WPARAM, LPARAM, LRESULT> in C#
printfn "Successfully Finished" Zip with repro:
MissingFieldExceptionRepro.zip
Expected behavior
Program finishes and prints "Successfully Finished"
Actual behavior
Throws exception
Unhandled exception. System.MissingFieldException: Field not found: 'TerraFX.Int
erop.Windows.WNDCLASSEXW.lpfnWndProc'.
at <StartupCode$MissingFieldExceptionRepro>.$Program.main@()
Known workarounds
No workarounds known to me
Related information
Provide any related information (optional):
- Operating system: Win11
- .NET Runtime kind (.NET Core, .NET Framework, Mono): .NET 6, SDK 6.0.100
- Editing Tools (e.g. Visual Studio Version, Visual Studio): Rider (and command line)
Here is the definition of the field in the TerraFX repo. Commenting out the assignment fixes the problem, but the field is required.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingArea-Compiler-Checking-Byrefbyref, inref, outref, byref-like types, NativePtr, function pointers, struct semanticsbyref, inref, outref, byref-like types, NativePtr, function pointers, struct semanticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Type
Projects
Status
New