Bug 14975 - Assert metadata/class.c:8201, condition `ac->rank' not met
Summary: Assert metadata/class.c:8201, condition `ac->rank' not met
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 7.0.0.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-09-24 23:16 UTC by Frank A. Krueger
Modified: 2017-09-01 21:39 UTC (History)
7 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 Developer Community or GitHub 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 Frank A. Krueger 2013-09-24 23:16:00 UTC
Sometimes a device (7.0.1) Debug build will fail while running with this assertion. Doing a full rebuild usually fixes it.

Sep 24 22:59:06  AudioTales[1960] <Critical>: * Assertion at ../../../../../mono/mono/metadata/class.c:8201, condition `ac->rank' not met
Sep 24 22:59:06  AudioTales[1960] <Error>: Stacktrace:
Sep 24 22:59:06  AudioTales[1960] <Error>:   at <unknown> <0xffffffff>
Sep 24 22:59:06  AudioTales[1960] <Error>:   at (wrapper managed-to-native) System.Array.Clone (System.Array) <0xffffffff>
Sep 24 22:59:06  AudioTales[1960] <Error>:   at ICSharpCode.SharpZipLib.Zip.ZipNameTransform..cctor () <IL 0x00022, 0x00137>
Sep 24 22:59:06  AudioTales[1960] <Error>:   at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
Sep 24 22:59:06  AudioTales[1960] <Error>:   at <unknown> <0xffffffff>
Sep 24 22:59:06  AudioTales[1960] <Error>:   at ICSharpCode.SharpZipLib.Zip.ZipEntryFactory..ctor () <IL 0x00019, 0x000db>
Sep 24 22:59:06  AudioTales[1960] <Error>:   at ICSharpCode.SharpZipLib.Zip.ZipFile..ctor (string) <IL 0x00013, 0x000c7>
Sep 24 22:59:06  AudioTales[1960] <Error>:   at Reader.iOS.Script.FromEpub (string) [0x00009] in /Users/fak/Dropbox/Projects/Reader/Reader.iOS/Script.cs:86

Native stacktrace:

Sep 24 22:59:06  AudioTales[1960] <Error>: 	0   AudioTales                          0x004edb83 mono_handle_native_sigsegv + 254
Sep 24 22:59:06  AudioTales[1960] <Error>: 	1   AudioTales                          0x004f28a7 sigabrt_signal_handler + 102
Sep 24 22:59:06  AudioTales[1960] <Error>: 	2   libsystem_platform.dylib            0x39410723 _sigtramp + 42
Sep 24 22:59:06  AudioTales[1960] <Error>: 	3   libsystem_pthread.dylib             0x39415a53 pthread_kill + 58
Sep 24 22:59:06  AudioTales[1960] <Error>: 	4   libsystem_c.dylib                   0x3935f02d abort + 76
Sep 24 22:59:06  AudioTales[1960] <Error>: 	5   AudioTales                          0x0057dd03 monoeg_assertion_message + 58
Sep 24 22:59:06  AudioTales[1960] <Error>: 	6   AudioTales                          0x0050ade1 mono_ldtoken + 0
Sep 24 22:59:06  AudioTales[1960] <Error>: 	7   AudioTales                          0x005395e9 mono_array_clone_in_domain + 68
Sep 24 22:59:06  AudioTales[1960] <Error>: 	8   AudioTales                          0x00539427 mono_array_clone + 14
Sep 24 22:59:06  AudioTales[1960] <Error>: 	9   AudioTales                          0x001f799c wrapper_managed_to_native_System_Array_Clone_System_Array + 100
Sep 24 22:59:06  AudioTales[1960] <Error>: 	10  AudioTales                          0x00494910 ICSharpCode_SharpZipLib_Zip_ZipNameTransform__cctor + 312
Sep 24 22:59:06  AudioTales[1960] <Error>: 	11  AudioTales                          0x002a8d50 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
Sep 24 22:59:06  AudioTales[1960] <Error>: 	12  AudioTales                          0x004f8a8d mono_jit_runtime_invoke + 1112
Sep 24 22:59:06  AudioTales[1960] <Error>: 	13  AudioTales                          0x00534abd mono_runtime_invoke + 88
Sep 24 22:59:06  AudioTales[1960] <Error>: 	14  AudioTales                          0x00534d75 mono_runtime_class_init_full + 524
Sep 24 22:59:06  AudioTales[1960] <Error>: 	15  AudioTales                          0x00534b67 mono_runtime_class_init + 10
Sep 24 22:59:06  AudioTales[1960] <Error>: 	16  AudioTales                          0x004f37c5 mono_class_init_trampoline + 44
Sep 24 22:59:06  AudioTales[1960] <Error>: 	17  AudioTales                          0x002d0ec4 generic_trampoline_class_init + 124
Sep 24 22:59:06  AudioTales[1960] <Error>: 	18  AudioTales                          0x0041f990 ICSharpCode_SharpZipLib_Zip_ZipFile__ctor_string + 200
Sep 24 22:59:06  AudioTales[1960] <Error>: 	19  AudioTales                          0x000a1464 Reader_iOS_Script_FromEpub_string + 516
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-10-14 05:48:59 UTC
How can I reproduce this? Do I just let it tell tales until it crashes, or is it build-related? (i.e. will a working build always work and a failing build always fail?)
Comment 2 Frank A. Krueger 2013-10-14 13:17:52 UTC
It happens when files are being loaded, when I use ICSharpCode.SharpZipLib.Zip.ZipFile.

That code lives in a DLL: AudioTales/Lib/CSharpCode.SharpZipLib.dll

That means opening epub files. I am not sure if it's a specific epub that causes problems or if it is a more sporadic error.
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-10-15 17:10:20 UTC
I tried downloading a bunch of different epubs [1], and they all worked. From the stack trace it doesn't look like it would be an epub-specific problem, but could you share any epubs you can reproduce it anyway?

[1] Try different languages, it turns out hilarious :)
Comment 4 Sebastien Pouliot 2013-10-15 17:34:02 UTC
The crash occurs in a static ctor so it must happens the first time it's used.

> ICSharpCode.SharpZipLib.Zip.ZipNameTransform..cctor ()

OTOH there's also nothing file-specific inside the static ctor source code (note: the IL match the code in [1]) so it's possible the issue is elsewhere (e.g. memory corruption).

[1] https://github.com/icsharpcode/SharpZipLib/blob/master/src/Zip/ZipNameTransform.cs#L73

There's no call to `Array.Clone` from the source (or IL) but that might be some internal/runtime optimization (e.g. inlining) ? (c.c. Zoltan)
Comment 5 Zoltan Varga 2013-10-15 23:34:47 UTC
We need a way to reproduce this to be able to fix it.
Comment 8 Zoltan Varga 2013-10-18 05:30:37 UTC
What do I have to do in the AudioTales app to reproduce the problem ?
Comment 9 Miguel de Icaza [MSFT] 2015-04-14 12:14:43 UTC
I am now getting this on Ubuntu, x86-64, when trying to bootstrap Mono when using a Mono 3.12.1 as the baseline (installed by running the following commands on top of Ubuntu's default):

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
apt-get install mono-mcs

make[2]: Entering directory `/cvs/mono/mcs/tools/gacutil'
/bin/sh ./../../mkinstalldirs ../../class/lib/net_4_5/
mkdir -p -- ../../class/lib/net_4_5/
touch ../../class/lib/net_4_5//.stamp
MCS     [net_4_5] gacutil.exe
The assembly mscorlib.dll was not found or could not be loaded.
It should have been installed in the `/mono/lib/mono/4.5/mscorlib.dll' directory.
make[2]: *** [../../class/lib/net_4_5/gacutil.exe] Error 1
make[2]: Leaving directory `/cvs/mono/mcs/tools/gacutil'
make[1]: *** [do-all] Error 2
make[1]: Leaving directory `/cvs/mono/mcs/tools/gacutil'
make: *** [all-recursive] Error 1
miguel@ubuntu:/cvs/mono/mcs/tools$ pwd
Comment 10 Miguel de Icaza [MSFT] 2015-04-14 12:15:05 UTC
miguel@ubuntu:/cvs/mono/mcs$ make
make[1]: Entering directory `/cvs/mono/runtime'
if test -w /cvs/mono/mcs; then :; else chmod -R +w /cvs/mono/mcs; fi
cd /cvs/mono/mcs && make --no-print-directory -s NO_DIR_CHECK=1 PROFILES='binary_reference_assemblies net_4_5 xbuild_12 xbuild_14   ' CC='gcc' all-profiles
Bootstrap compiler: Mono C# compiler version
MCS     [build] mscorlib.dll
* Assertion at class.c:8492, condition `ac->rank' not met


Native stacktrace:

	/cvs/mono/mono/mini/mono(mono_handle_native_sigsegv+0xc8) [0x4d1858]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x2adb0bfd9340]
	/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x39) [0x2adb0c21dcc9]
	/lib/x86_64-linux-gnu/libc.so.6(abort+0x148) [0x2adb0c2210d8]
	/cvs/mono/mono/mini/mono() [0x661ef9]
	/cvs/mono/mono/mini/mono(monoeg_g_logv+0x3f) [0x6620ff]
	/cvs/mono/mono/mini/mono(monoeg_assertion_message+0x96) [0x662246]
	/cvs/mono/mono/mini/mono() [0x54ba89]
	/cvs/mono/mono/mini/mono(mono_array_calc_byte_len+0x11) [0x5e1a81]
	/cvs/mono/mono/mini/mono(mono_array_new_specific+0x22) [0x5e1d72]
	/cvs/mono/mono/mini/mono(mono_runtime_run_main+0x13b) [0x5e285b]
	/cvs/mono/mono/mini/mono(mono_main+0x11ec) [0x4a683c]
	/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5) [0x2adb0c208ec5]
	/cvs/mono/mono/mini/mono() [0x44c164]

Debug info from gdb:
Comment 12 Vincent Dondain [MSFT] 2017-09-01 21:39:17 UTC
"I was not able to follow the steps to reproduce the issue. I don't end up with any /cvs"

I think you can disregard "/cvs", it's just whatever folder on Miguel's machine, he's just in the mono repo FWIW.

However we can't reproduce this issue anymore this the repo/test case isn't available anymore.

If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!