-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
Description
The MethodInfo.GetInstructions() extension found in Mono.Reflection can result in crashes when parsing dynamic assembly IL. This makes Vagrant practically unusable in mono. The following F# script reproduces the issue
#r "Mono.Reflection.dll" // the standard Mono.Reflection library found on nuget
open System
open System.Reflection
open Mono.Reflection
type Foo<'T> = Foo of 'T
type Mapper =
static member map (f : 'a -> 'b, Foo x) = Foo (f x)
let m = typeof<Mapper>.GetMethod("map")
let instructions = m.GetInstructions()
let field =
instructions
|> Seq.pick(fun i -> match i.Operand with :? FieldInfo as f -> Some f | _ -> None)
field.ToString() // "a item"
field.MetadataToken // crashes with '* Assertion at reflection.c:7764, condition `field_index >= 0 && field_index < dgclass->count_fields' not met'