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 the StructLayoutAttribute 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.