Bug 49016 - Crash with System.TypeLoadException with variant and Seq.toList in fsx file
Summary: Crash with System.TypeLoadException with variant and Seq.toList in fsx file
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 4.6.0 (C8)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-12-05 15:24 UTC by Sam Gronblom
Modified: 2017-10-06 23:33 UTC (History)
3 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Sam Gronblom 2016-12-05 15:24:10 UTC
When running the following command:

fsharpi typeLoadException.fsx typeLoadException.fsx

Source (typeLoadException.fsx):

let inputFile = fsi.CommandLineArgs.[1]

type WrappedString = WrappedString of string
let inputLengths = Seq.map WrappedString (System.IO.File.ReadLines inputFile) |> Seq.toList

printf "%A\n" inputLength

It crashes with the following stack trace:

> fsharpi typeLoadException.fsx typeLoadException.fsx
System.TypeLoadException: Failure has occurred while loading a type.
  at FSI_0001+inputLengths@4.Invoke (System.String arg0) [0x00001] in <daef9143e2204dc29458c917a4445435>:0
  at Microsoft.FSharp.Collections.IEnumerator+map@111[b,a].DoMoveNext (b& ) [0x00020] in <58252458dff9fae1a745038358242558>:0
  at Microsoft.FSharp.Collections.IEnumerator+MapEnumerator`1[T].System-Collections-IEnumerator-MoveNext () [0x0000c] in <58252458dff9fae1a745
  at Microsoft.FSharp.Collections.SeqModule.ToList[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x0003f] in <58252458dff9fae1a7450
  at <StartupCode$FSI_0001>.$FSI_0001.main@ () [0x0002e] in <daef9143e2204dc29458c917a4445435>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, Syste
m.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in <8f2c484307284b51944a1a13a14c0266>:0
Stopped due to error

OSX Version: 10.11.6 El Capitan
mono --version:
Mono JIT compiler version 4.6.2 (mono-4.6.0-branch/08fd525 Thu Nov 10 20:28:28 EST 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug
	LLVM:          yes(3.6.0svn-mono-master/8b1520c)
	GC:            sgen
Comment 1 Ludovic Henry 2017-10-06 23:33:10 UTC
I cannot reproduce with Mono (2017-10/a3943e28cf8)

Note You need to log in before you can comment on or make changes to this bug.