Bug 45758 - "Specified cast is not valid" on ARM64
Summary: "Specified cast is not valid" on ARM64
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2016-10-20 18:37 UTC by Andi McClure
Modified: 2017-09-06 15:10 UTC (History)
3 users (show)

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:

Description Andi McClure 2016-10-20 18:37:32 UTC
In our automated tests we have started seeing this failure

Unhandled Exception:
System.InvalidCastException: Specified cast is not valid.
  at Gen`1[T].ident (T t) [0x00002] in <da161533e61049b6b9ac4f21f8f692fc>:0 
  at main.Main () [0x0001d] in <da161533e61049b6b9ac4f21f8f692fc>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidCastException: Specified cast is not valid.
  at Gen`1[T].ident (T t) [0x00002] in <da161533e61049b6b9ac4f21f8f692fc>:0 
  at main.Main () [0x0001d] in <da161533e61049b6b9ac4f21f8f692fc>:0 

In the tests MonoTests.gshared.generic-refanyval.2.exe and MonoTests.runtime.vararg.exe . We also see this during compiler verification tests. We appear to see this only on ARM64. We started seeing this between 57d111 and 66fb48, which is weird, because the only commit in between (919824ddd43) concerns only sockets and sqlsharp. For an example see:

Comment 1 Andi McClure 2016-10-20 18:50:48 UTC
Ludovic suspects https://github.com/mono/mono/pull/3783/commits/99c2c9d8084444c5b73064d1552cf84279a6597b as culprit
Comment 2 Zoltan Varga 2016-10-21 04:46:05 UTC
Can't reproduce this.