Bug 34082 - Mono 4.0.4 F# Compiler -- Unexpected System.NullReferenceException
Summary: Mono 4.0.4 F# Compiler -- Unexpected System.NullReferenceException
Alias: None
Product: Compilers
Classification: Mono
Component: Other ()
Version: 4.0.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-09-18 22:30 UTC by Taro Kuriyama
Modified: 2017-08-28 22:55 UTC (History)
3 users (show)

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

code snippet that causes crash (377 bytes, application/octet-stream)
2015-09-18 22:30 UTC, Taro Kuriyama

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:

Description Taro Kuriyama 2015-09-18 22:30:53 UTC
Created attachment 12975 [details]
code snippet that causes crash

The enclosed code snippet is reported to compile normally in various permutations of F# 3.0 and 3.1, Visual F#, Mono... (see http://stackoverflow.com/questions/32621571/unexpected-nullreferenceexception-in-f-algorithm)

However, it crashes and returns the following error when run on my local environment (OS X 10.10.5 / Mono 4.0.4). Error message and mono version information below.


> unmerges [1;2;3];;

System.NullReferenceException: Object reference not set to an instance of an object
  at Microsoft.FSharp.Core.Operators.op_Append[Tuple`2] (Microsoft.FSharp.Collections.FSharpList`1 list1, Microsoft.FSharp.Collections.FSharpList`1 list2) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Primitives.Basics.List.concat[Tuple`2] (IEnumerable`1 l) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Collections.ListModule.Concat[Tuple`2] (IEnumerable`1 lists) [0x00000] in <filename unknown>:0 
  at FSI_0055.concatMap[Tuple`2,Tuple`2] (Microsoft.FSharp.Core.FSharpFunc`2 f, Microsoft.FSharp.Collections.FSharpList`1 m) [0x00000] in <filename unknown>:0 
  at FSI_0055.unmerges[Int32] (Microsoft.FSharp.Collections.FSharpList`1 ints) [0x00000] in <filename unknown>:0 
  at <StartupCode$FSI_0057>.$FSI_0057.main@ () [0x00000] in <filename unknown>: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, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
Stopped due to error


tarokuriyama ~ $ sw_vers -productVersion
tarokuriyama ~ $ mono --version
Mono JIT compiler version 4.0.4 ((detached/5ab4c0d Tue Aug 25 08:35:07 EDT 2015)
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-(detached/a173357)
	GC:            sgen
Comment 1 Taro Kuriyama 2015-09-19 07:07:16 UTC
Probably related to https://bugzilla.xamarin.com/show_bug.cgi?id=32630

Installed current alpha channel (Mono 4.2.1 / Xamarin 5.10) and the issue is no longer observed.