Skip to content

Mono runtime crashes when running Vagabond #2

@eiriktsarpalis

Description

@eiriktsarpalis

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'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions