Bug 58950 - Create NuGet package from csproj crashes on Android
Summary: Create NuGet package from csproj crashes on Android
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: 5.2 (2017-04)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Aleksey Kliger
URL:
Depends on:
Blocks:
 
Reported: 2017-08-22 12:47 UTC by Kim
Modified: 2017-09-13 17:26 UTC (History)
6 users (show)

Tags: NuGet, mono
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 Kim 2017-08-22 12:47:07 UTC
Hello! 

I try to pack my NuGet, but it crashes. 

I have found that if i clear the auto generated file Resource.desginer.cs it works. 

The command is 

idealpraktik$ /Library/Frameworks/Mono.framework/Versions/5.2.0/bin/mono /Users/idealpraktik/Downloads/TeamCity/buildAgent/plugins/nuget-agent/bin/JetBrains.TeamCity.NuGetRunner.exe /Users/idealpraktik/Downloads/TeamCity/buildAgent/tools/NuGet.CommandLine.4.3.0/tools/NuGet.exe pack /Users/idealpraktik/Downloads/TeamCity/buildAgent/work/d230168d7a738827/Xamarin.UI.Android/Xamarin.UI.Android/Xamarin.UI.Droid.csproj -OutputDirectory /Users/idealpraktik/Downloads/TeamCity/buildAgent/work/d230168d7a738827/nuget/android -Properties Configuration=Release


Here is the error:

JetBrains TeamCity NuGet Runner 8.0.46961.9
Registered additional extensions from paths: /Users/idealpraktik/Downloads/TeamCity/buildAgent/plugins/nuget-agent/bin/plugins-4.0
Starting NuGet.exe 4.3.0.6 from /Users/idealpraktik/Downloads/TeamCity/buildAgent/tools/NuGet.CommandLine.4.3.0/tools/NuGet.exe
Attempting to build package from 'Xamarin.UI.Droid.csproj'.
MSBuild auto-detection: using msbuild version '15.0' from '/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/'.
Packing files from '/Users/idealpraktik/Downloads/TeamCity/buildAgent/work/d230168d7a738827/Xamarin.UI.Android/Xamarin.UI.Android/bin/Release'.
* Assertion at handle.c:295, condition `mono_object_domain (elem->o) != domain' not met

Stacktrace:


Native stacktrace:

	0   mono-sgen64                         0x0000000101206061 mono_handle_native_crash + 257
	1   libsystem_platform.dylib            0x00007fffb9b68b3a _sigtramp + 26
	2   ???                                 0x000000010bff2551 0x0 + 4496237905
	3   libsystem_c.dylib                   0x00007fffb99ed420 abort + 129
	4   mono-sgen64                         0x00000001013dd591 mono_log_write_logfile + 353
	5   mono-sgen64                         0x00000001013f4830 monoeg_assertion_message + 192
	6   mono-sgen64                         0x0000000101348344 mono_handle_stack_free_domain + 180
	7   mono-sgen64                         0x000000010139054c mono_gc_clear_domain + 156
	8   mono-sgen64                         0x00000001013532e8 mono_domain_free + 392
	9   mono-sgen64                         0x0000000101350bae unload_thread_main + 830
	10  mono-sgen64                         0x0000000101329a6b start_wrapper + 715
	11  libsystem_pthread.dylib             0x00007fffb9b7293b _pthread_body + 180
	12  libsystem_pthread.dylib             0x00007fffb9b72887 _pthread_body + 0
	13  libsystem_pthread.dylib             0x00007fffb9b7208d thread_start + 13

Debug info from gdb:

(lldb) command source -s 0 '/tmp/mono-gdb-commands.uQ9haG'
Executing commands in '/tmp/mono-gdb-commands.uQ9haG'.
(lldb) process attach --pid 4353
warning: (x86_64) /Library/Frameworks/Mono.framework/Versions/5.2.0/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info.
Process 4353 stopped
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fffb9a87bf2 libsystem_kernel.dylib`__psynch_cvwait + 10
libsystem_kernel.dylib`__psynch_cvwait:
->  0x7fffb9a87bf2 <+10>: jae    0x7fffb9a87bfc            ; <+20>
    0x7fffb9a87bf4 <+12>: movq   %rax, %rdi
    0x7fffb9a87bf7 <+15>: jmp    0x7fffb9a80caf            ; cerror_nocancel
    0x7fffb9a87bfc <+20>: retq   

Executable module set to "/Library/Frameworks/Mono.framework/Versions/5.2.0/bin/mono-sgen64".
Architecture set to: x86_64h-apple-macosx.
(lldb) thread list
Process 4353 stopped
* thread #1: tid = 0x386ea, 0x00007fffb9a87bf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x386ed, 0x00007fffb9a87bf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SGen worker'
  thread #3: tid = 0x386f1, 0x00007fffb9a80386 libsystem_kernel.dylib`semaphore_wait_trap + 10, name = 'Finalizer'
  thread #4: tid = 0x386f2, 0x00007fffb9a8844e libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #5: tid = 0x386f3, 0x00007fffb9a8844e libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #6: tid = 0x386f4, 0x00007fffb9a8844e libsystem_kernel.dylib`__workq_kernreturn + 10
  thread #7: tid = 0x38701, 0x00007fffb9a883ee libsystem_kernel.dylib`__wait4 + 10, name = 'Domain unloader'
(lldb) thread backtrace all
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fffb9a87bf2 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fffb9b737fa libsystem_pthread.dylib`_pthread_cond_wait + 712
    frame #2: 0x00000001013d7198 mono-sgen64`mono_os_event_wait_multiple [inlined] mono_os_cond_wait(mutex=<unavailable>) at mono-os-mutex.h:173 [opt]
    frame #3: 0x00000001013d718c mono-sgen64`mono_os_event_wait_multiple(events=0x00007fff5eab2b68, nevents=1, waitall=1, timeout=4294967295, alertable=1) at os-event-unix.c:190 [opt]
    frame #4: 0x00000001013d6f56 mono-sgen64`mono_os_event_wait_one(event=0x00007fe69844ba20, timeout=<unavailable>, alertable=<unavailable>) at os-event-unix.c:94 [opt]
    frame #5: 0x00000001013eae9d mono-sgen64`mono_thread_info_wait_one_handle(thread_handle=<unavailable>, timeout=<unavailable>, alertable=<unavailable>) at mono-threads.c:1570 [opt]
    frame #6: 0x0000000101350271 mono-sgen64`mono_domain_try_unload [inlined] guarded_wait(timeout=4294967295, alertable=1) at appdomain.c:2605 [opt]
    frame #7: 0x0000000101350250 mono-sgen64`mono_domain_try_unload(domain=0x00007fe69837fff0, exc=0x00007fff5eab2c68) at appdomain.c:2706 [opt]
    frame #8: 0x0000000101350030 mono-sgen64`ves_icall_System_AppDomain_InternalUnload(domain_id=<unavailable>, error=0x00007fff5eab2cd8) at appdomain.c:2235 [opt]
    frame #9: 0x000000010662a1f5
    frame #10: 0x00000001065c144d
    frame #11: 0x000000010641db66
    frame #12: 0x0000000105a0c3bc

  thread #2, name = 'SGen worker'
    frame #0: 0x00007fffb9a87bf2 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fffb9b737fa libsystem_pthread.dylib`_pthread_cond_wait + 712
    frame #2: 0x00000001013d4b55 mono-sgen64`thread_func [inlined] mono_os_cond_wait(mutex=0x000000010152a848) at mono-os-mutex.h:173 [opt]
    frame #3: 0x00000001013d4b46 mono-sgen64`thread_func(thread_data=0x000000010165e108) at sgen-thread-pool.c:130 [opt]
    frame #4: 0x00007fffb9b7293b libsystem_pthread.dylib`_pthread_body + 180
    frame #5: 0x00007fffb9b72887 libsystem_pthread.dylib`_pthread_start + 286
    frame #6: 0x00007fffb9b7208d libsystem_pthread.dylib`thread_start + 13

  thread #3, name = 'Finalizer'
    frame #0: 0x00007fffb9a80386 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x0000000101356693 mono-sgen64`finalizer_thread [inlined] mono_os_sem_wait(flags=MONO_SEM_FLAGS_ALERTABLE) at mono-os-semaphore.h:91 [opt]
    frame #2: 0x0000000101356688 mono-sgen64`finalizer_thread [inlined] mono_coop_sem_wait(flags=MONO_SEM_FLAGS_ALERTABLE) at mono-coop-semaphore.h:43 [opt]
    frame #3: 0x0000000101356680 mono-sgen64`finalizer_thread(unused=<unavailable>) at gc.c:866 [opt]
    frame #4: 0x0000000101329a6b mono-sgen64`start_wrapper [inlined] start_wrapper_internal at threads.c:829 [opt]
    frame #5: 0x00000001013299d1 mono-sgen64`start_wrapper(data=<unavailable>) at threads.c:891 [opt]
    frame #6: 0x00007fffb9b7293b libsystem_pthread.dylib`_pthread_body + 180
    frame #7: 0x00007fffb9b72887 libsystem_pthread.dylib`_pthread_start + 286
    frame #8: 0x00007fffb9b7208d libsystem_pthread.dylib`thread_start + 13

  thread #4
    frame #0: 0x00007fffb9a8844e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fffb9b72621 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00007fffb9b7207d libsystem_pthread.dylib`start_wqthread + 13

  thread #5
    frame #0: 0x00007fffb9a8844e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fffb9b7248e libsystem_pthread.dylib`_pthread_wqthread + 1023
    frame #2: 0x00007fffb9b7207d libsystem_pthread.dylib`start_wqthread + 13

  thread #6
    frame #0: 0x00007fffb9a8844e libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fffb9b72621 libsystem_pthread.dylib`_pthread_wqthread + 1426
    frame #2: 0x00007fffb9b7207d libsystem_pthread.dylib`start_wqthread + 13

  thread #7, name = 'Domain unloader'
    frame #0: 0x00007fffb9a883ee libsystem_kernel.dylib`__wait4 + 10
    frame #1: 0x00000001012060ed mono-sgen64`mono_handle_native_crash(signal="SIGABRT", ctx=<unavailable>, info=<unavailable>) at mini-exceptions.c:2555 [opt]
    frame #2: 0x00007fffb9b68b3a libsystem_platform.dylib`_sigtramp + 26
    frame #3: 0x00007fffb9a87d43 libsystem_kernel.dylib`__pthread_kill + 11
    frame #4: 0x00007fffb9b75457 libsystem_pthread.dylib`pthread_kill + 90
    frame #5: 0x00007fffb99ed420 libsystem_c.dylib`abort + 129
    frame #6: 0x00000001013dd591 mono-sgen64`mono_log_write_logfile(log_domain=<unavailable>, level=<unavailable>, hdr=<unavailable>, message=<unavailable>) at mono-log-common.c:135 [opt]
    frame #7: 0x00000001013f4830 mono-sgen64`monoeg_assertion_message [inlined] monoeg_g_logv(log_domain=<unavailable>, log_level=G_LOG_LEVEL_ERROR) at goutput.c:115 [opt]
    frame #8: 0x00000001013f47ec mono-sgen64`monoeg_assertion_message(format=<unavailable>) at goutput.c:135 [opt]
    frame #9: 0x0000000101348344 mono-sgen64`mono_handle_stack_free_domain(stack=<unavailable>, domain=<unavailable>) at handle.c:295 [opt]
    frame #10: 0x000000010139054c mono-sgen64`mono_gc_clear_domain(domain=0x00007fe69837fff0) at sgen-mono.c:891 [opt]
    frame #11: 0x00000001013532e8 mono-sgen64`mono_domain_free(domain=0x00007fe69837fff0, force=<unavailable>) at domain.c:1089 [opt]
    frame #12: 0x0000000101350bae mono-sgen64`unload_thread_main(arg=0x00007fe69844d6b0) at appdomain.c:2571 [opt]
    frame #13: 0x0000000101329a6b mono-sgen64`start_wrapper [inlined] start_wrapper_internal at threads.c:829 [opt]
    frame #14: 0x00000001013299d1 mono-sgen64`start_wrapper(data=<unavailable>) at threads.c:891 [opt]
    frame #15: 0x00007fffb9b7293b libsystem_pthread.dylib`_pthread_body + 180
    frame #16: 0x00007fffb9b72887 libsystem_pthread.dylib`_pthread_start + 286
    frame #17: 0x00007fffb9b7208d libsystem_pthread.dylib`thread_start + 13
(lldb) detach
Process 4353 detached
(lldb) quit

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
Comment 1 Ludovic Henry 2017-09-01 00:09:45 UTC
Could you please provide a reproduction case, so that we can run it on our end? Thank you
Comment 2 Kim 2017-09-01 08:04:42 UTC
https://github.com/kimdv/NugetMonoCrash

Project, and step by step guide can be found here.
Comment 3 Ludovic Henry 2017-09-01 18:14:46 UTC
Aleksey, could you please take a look at this one? Thank you
Comment 4 Attila Tamás Zimler 2017-09-08 03:23:40 UTC
Hi, I'm also hitting the same problem but with building iOS project, through Jenkins, with directly downloaded NuGet.exe from nuget.org.

The same assertion is failing, it might be that the crash is not related to the project itself, but to NuGet.exe. In hope that additional information could help fixing the problem quicker, here is my stack trace:
     [exec] Starting '/opt/local/bin/nuget (pack /Users/Shared/Jenkins/SuperNova.Nodes.StarLight/workspace/ATZ.PropertyEditor/Source/PropertyEditor/ATZ.PropertyEditor.iOS/ATZ.PropertyEditor.iOS.csproj -IncludeReferencedProjects )' in '/Users/Shared/Jenkins/SuperNova.Nodes.StarLight/workspace/ATZ.PropertyEditor/Source/PropertyEditor/ATZ.PropertyEditor.iOS'
     [exec] Attempting to build package from 'ATZ.PropertyEditor.iOS.csproj'.
     [exec] MSBuild auto-detection: using msbuild version '15.0' from '/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/'.
     [exec] Packing files from '/Users/Shared/Jenkins/SuperNova.Nodes.StarLight/workspace/ATZ.PropertyEditor/Source/PropertyEditor/ATZ.PropertyEditor.iOS/bin/Debug'.
     [exec] * Assertion at handle.c:295, condition `mono_object_domain (elem->o) != domain' not met
     [exec] 
     [exec] Stacktrace:
     [exec] 
     [exec] 
     [exec] Native stacktrace:
     [exec] 
     [exec]  0   mono                                0x0000000107d33061 mono_handle_native_crash + 257
     [exec]  1   libsystem_platform.dylib            0x00007fffb85e8b3a _sigtramp + 26
     [exec]  2   ???                                 0x0000000108d71551 0x0 + 4443280721
     [exec]  3   libsystem_c.dylib                   0x00007fffb846d420 abort + 129
     [exec]  4   mono                                0x0000000107f0a591 mono_log_write_logfile + 353
     [exec]  5   mono                                0x0000000107f21830 monoeg_assertion_message + 192
     [exec]  6   mono                                0x0000000107e75344 mono_handle_stack_free_domain + 180
     [exec]  7   mono                                0x0000000107ebd54c mono_gc_clear_domain + 156
     [exec]  8   mono                                0x0000000107e802e8 mono_domain_free + 392
     [exec]  9   mono                                0x0000000107e7dbae unload_thread_main + 830
     [exec]  10  mono                                0x0000000107e56a6b start_wrapper + 715
     [exec]  11  libsystem_pthread.dylib             0x00007fffb85f293b _pthread_body + 180
     [exec]  12  libsystem_pthread.dylib             0x00007fffb85f2887 _pthread_body + 0
     [exec]  13  libsystem_pthread.dylib             0x00007fffb85f208d thread_start + 13
     [exec] 
     [exec] Debug info from gdb:
     [exec] 
     [exec] (lldb) command source -s 0 '/tmp/mono-gdb-commands.olpKqM'
     [exec] Executing commands in '/tmp/mono-gdb-commands.olpKqM'.
     [exec] (lldb) process attach --pid 78840
     [exec] error: attach failed: unable to attach
     [exec] 
     [exec] =================================================================
     [exec] Got a SIGABRT while executing native code. This usually indicates
     [exec] a fatal error in the mono runtime or one of the native libraries 
     [exec] used by your application.
     [exec] =================================================================
     [exec]
Comment 5 Attila Tamás Zimler 2017-09-08 03:25:31 UTC
Also the NuGet.exe version in my case is 4.3.0.4406
Comment 6 Aleksey Kliger 2017-09-08 15:19:44 UTC
I can reproduce the steps from Comment 2 with mono version 5.6.0.0 (2017-08/9417be0) running NuGet 4.3.0.4406

the commandline invoked by TeamCity is:

> /Library/Frameworks/Mono.framework/Versions/5.6.0/bin/mono /Users/alekseyk/Downloads/TeamCity/buildAgent/tools/NuGet.CommandLine.4.3.0/tools/NuGet.exe pack /Users/alekseyk/Downloads/TeamCity/buildAgent/work/afbfd06ec8ae1a15/TestProject/TestProject/TestProject.csproj -OutputDirectory /Users/alekseyk/Downloads/TeamCity/buildAgent/work/afbfd06ec8ae1a15/nuget -Properties Configuration=Release

(the above command fails if I run it directly, too).

Thanks for the reproduction steps, everyone!
Comment 7 Ludovic Henry 2017-09-13 17:19:43 UTC
Fixed on master with https://github.com/mono/mono/pull/5535
Comment 8 Ludovic Henry 2017-09-13 17:26:03 UTC
Fixed on 2017-06 with https://github.com/mono/mono/pull/5557 and 2017-08 with https://github.com/mono/mono/pull/5556