FS0009: Possible unverifiable code
This message is given when:
- a function marked with the
Unverifiable
attribute is used,
let n: nativeptr<bool> = NativeInterop.NativePtr.stackalloc 1
- the
fixed
expression is used, or
type R = { Address: int }
let useFixed (r: R) =
use f = fixed &r.Address
()
LayoutKind.Explicit
is set in theStructLayoutAttribute
of a struct definition
open System.Runtime.InteropServices
[<Struct; StructLayout(LayoutKind.Explicit)>]
type EmptyStruct =
struct end
In each of these cases, the compiler will give the following message:
FS0009: Uses of this construct may result in the generation of unverifiable .NET IL code. This warning can be disabled using '--nowarn:9' or '#nowarn "9"'
To fix this message, you can either add the #nowarn
directive to the source code file containing the usage, add <NoWarn>9</NoWarn>
to your project file, or manually add --nowarn:9
to your F# compiler invocations. Note that the last two mechanisms will disable the warning for your entire project, whereas the first mechanism will disable the warning for only one file.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for