Bug 40568 - Runtime crashing on System.Enum.GetValues on char enums with F#
Summary: Runtime crashing on System.Enum.GetValues on char enums with F#
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection ()
Version: 4.2.0 (C6)
Hardware: PC All
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-04-20 19:56 UTC by Eirik Tsarpalis
Modified: 2016-04-21 21:27 UTC (History)
2 users (show)

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


Attachments
Reproducing F# console app (155 bytes, text/plain)
2016-04-20 19:56 UTC, Eirik Tsarpalis
Details


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 Eirik Tsarpalis 2016-04-20 19:56:06 UTC
Created attachment 15791 [details]
Reproducing F# console app

Here's a small reproduction of the crash using a simple F# console app:

module Test

type Enum = A = 'A' | B = 'B'

[<EntryPoint>]
let main _ =
    let values = System.Enum.GetValues(typeof<Enum>)
    printfn "%A" values
    0

Which when run crashes with the following error message:

* Assertion: should not be reached at icall.c:2963

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Enum.InternalBoxEnum (System.RuntimeType,long) <0xffffffff>
  at System.Enum.ToObject (System.Type,ulong) <0x00096>
  at System.RuntimeType.GetEnumValues () <0x00062>
  at System.Enum.GetValues (System.Type) <0x0002d>
  at Test.main (string[]) <0x0001a>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	mono() [0x49d5fc]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x10d10) [0x7f1338d3cd10]
	/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x37) [0x7f1338997267]
	/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f1338998eca]
	mono() [0x62ac69]
	mono() [0x62ae77]
	mono() [0x62afc6]
	mono() [0x536e21]
	[0x413118b8]


Reproducing consistently in mono 4.2 in both mac and linux. 
Strangely enough, I could not get the equivalent C# code to crash.
Comment 1 Zoltan Varga 2016-04-21 21:27:38 UTC
Fixed in mono master 92bcc1db28f6e1341b54ba7287814fcf16cfbb30.