Skip to content

FSharp.Reflection.FSharpValue.MakeTuple broken for value tuples #4240

Closed

Description

@eiriktsarpalis

The method FSharp.Reflection.FSharpValue.MakeTuple is broken for value tuples.

Repro steps

The code

open System.Reflection

FSharpType.IsTuple typeof<struct(int * int)> // true
FSharpValue.MakeTuple([|1;2|], typeof<struct(int * int)>)

fails with the exception

The tuple type 'System.ValueTuple`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' is invalid. Required constructor is not defined.

This seems to be caused by this line, which is lacking a BindingFlags.Instance flag, resulting in no fields being returned.

Related to fscheck/FsCheck#422

Activity

  1. added
    Impact-Medium
    Area-Library
    on Jan 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-LibraryBugImpact-Medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions