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
Status: RESOLVED FIXED
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
URL:
Depends on:
Blocks:
 
Reported: 2016-12-05 15:24 UTC by Sam Gronblom
Modified: 2017-10-06 23:33 UTC (History)
3 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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
038358242558>:0
  at Microsoft.FSharp.Collections.SeqModule.ToList[T] (System.Collections.Generic.IEnumerable`1[T] source) [0x0003f] in <58252458dff9fae1a7450
38358242558>:0
  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 5.8.0.2 (2017-10/a3943e28cf8)