Bug 17419 - Xamarin.iOSforVS update results in SIGABRT crash
Summary: Xamarin.iOSforVS update results in SIGABRT crash
Status: RESOLVED DOWNSTREAM
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 1.8.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jose Miguel Torres
URL:
Depends on:
Blocks:
 
Reported: 2014-01-24 13:09 UTC by Allie Miller
Modified: 2014-02-14 05:40 UTC (History)
5 users (show)

Tags:
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 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 DOWNSTREAM

Description Allie Miller 2014-01-24 13:09:05 UTC
After updating to the latest version of Xamarin iOS, when building and deploying to the iOS simulator the following exception occurs: 

stderr:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at MonoTouch.ObjCRuntime.Class.RegisterMap (Int32 size, MTClassMap* map) [0x00051] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Class.cs:44
at MonoTouch.ObjCRuntime.Class.Initialize (MonoTouch.ObjCRuntime.InitializationOptions& options) [0x00012] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Class.cs:31
at MonoTouch.ObjCRuntime.Runtime.Initialize (MonoTouch.ObjCRun
time.InitializationOptions& options) [0x00073] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:96
2014-01-17 15:04:12.508 TimeExpenses[601:a0b] Unhandled managed exception: Object reference not set to an instance of an object (System.NullReferenceException)
at MonoTouch.ObjCRuntime.Class.RegisterMap (Int32 size, MTClassMap* map) [0x00051] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Class.cs:44
at MonoTouch.ObjCRuntime.Class.Initialize (MonoTouch.ObjCRuntime.Initializat
ionOptiostderr: ns& options) [0x00012] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Class.cs:31
at MonoTouch.ObjCRuntime.Runtime.Initialize (MonoTouch.ObjCRuntime.InitializationOptions& options) [0x00073] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:96
mono-rt: Stacktrace:


mono-rt:
Native stacktrace:


mono-rt: 0 TimeExpenses 0x000b4d5d mono_handle_native_sigsegv + 349

mono-rt: 1 TimeExpenses 0x000bfd2a sigabrt_si
gnal_handler + 122

mono-rt: 2 libsystem_c.dylib 0x0546e94b _sigtramp + 43

mono-rt: 3 ??? 0xffffffff 0x0 + 4294967295

mono-rt: 4 libsystem_sim_c.dylib 0x05125e12 abort + 127

mono-rt: 5 TimeExpenses 0x00232023 monotouch_unhandled_exception_handler + 291

mono-rt: 6 TimeExpenses 0x000b558b mono_invoke_unhandled_exception_hook + 91

mono-rt: 7 TimeExpenses 0x
000b45a9 mono_ha
stderr: ndle_exception_internal + 3817

mono-rt: 8 TimeExpenses 0x000b36b9 mono_handle_exception + 41

mono-rt: 9 TimeExpenses 0x0005a084 altstack_handle_and_restore + 148

mono-rt: 10 ??? 0x0e3a4c3c 0x0 + 238701628

mono-rt: 11 ??? 0x0e3a4b9c 0x0 + 238701468

mono-rt: 12 ??? 0x0e3a39f0 0x0 + 238696944

mono-rt: 13 ??? 0x0
e3a3adf 0x0 + 238697183

mono-rt: 14 TimeExpenses 0x000e4686 mono_jit_runtime_invoke + 790

mono-rt: 15 TimeExpenses 0x0017ea9f mono_runtime_invoke + 127

mono-rt: 16 TimeExpenses 0x00222d80 monotouch_init + 1312

mono-rt: 17 TimeExpenses 0x0021bc22 main + 1970

mono-rt: 18 TimeExpenses 0x000032d5 start + 53

mono-rt: 19 ??? 0x00000004 0x0 + 4

mono-r
t:
====stderr: =============================================================
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.
=================================================================

Clearing out Visual Studio build folders and cache on the Mac does not resolve the issue. The user has also attempted to re-install the software, but the crash continues.

Attached to this report is a test case, mtbserver log, Trace log file and crash report.

Versioning Information:
On Windows:
Microsoft Visual Studio Premium 2012
Version 11.0.60315.01 Update 2
Microsoft .NET Framework
Version 4.5.50709
Xamarin.Android 4.10.01073 (d23a19bf)
Xamarin.iOS 1.8.365 (8cb9dbd0)


On Mac:
=== Xamarin Studio ===
Version 4.2.2 (build 2)
Installation UUID: 7e73030d-6977-4715-8f61-17e02c46dd5c
Runtime:
Mono 3.2.5 ((no/964e8f0)
GTK+ 2.24.20 theme: Raleigh
GTK# (2.12.0.0)
=== Apple Developer Tools ===
Xcode 5.0.2 (3335.32)
Build 5A3005
=== Xamarin.Mac ===
Xamarin.Mac: Not Installed
=== Xamarin.Android ===
Not Installed
=== Xamarin.iOS ===
Version: 7.0.5.2 (Business Edition)
=== Operating System ===
Mac OS X 10.8.5
Comment 6 Jose Miguel Torres 2014-01-29 07:07:18 UTC
Could you surround the "UIApplication.Main(args, null, "AppDelegate");" on the Main.cs file? I haven't been unable to run the app, but looks like there is some unhandled null reference execption somewhere...

Please let me know, thanks.
Comment 7 Jim 2014-01-29 07:41:16 UTC
Previous testing has shown that none of our code gets called.

As requested, I have done what you asked.

        // This is the main entry point of the application.
        static void Main(string[] args)
        {
            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            try
            {
                UIApplication.Main(args, null, "AppDelegate");
            }
            catch (Exception exception)
            {
                Console.WriteLine("App.Main");
                Console.WriteLine(exception.StackTrace);
                throw;
            }
        }

This is the entire VS output window:

Getting device...
Starting debug on:iPhone (Retina) 7.0
Remote build finished...
Running TimeExpensesstderr: 
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at MonoTouch.ObjCRuntime.Class.RegisterMap (Int32 size, MTClassMap* map) [0x00051] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Class.cs:44 
  at MonoTouch.ObjCRuntime.Class.Initialize (MonoTouch.ObjCRuntime.InitializationOptions& options) [0x00012] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Class.cs:31 
  at MonoTouch.ObjCRuntime.Runtime.Initialize (MonoTouch.ObjCRun
time.InitializationOptions& options) [0x00073] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:96 
2014-01-29 12:36:07.063 TimeExpenses[5454:a0b] Unhandled managed exception: Object reference not set to an instance of an object (System.NullReferenceException)
  at MonoTouch.ObjCRuntime.Class.RegisterMap (Int32 size, MTClassMap* map) [0x00051] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Class.cs:44 
  at MonoTouch.ObjCRuntime.Class.Initialize (MonoTouch.ObjCRuntime.Initializa
tionOptistderr: ons& options) [0x00012] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Class.cs:31 
  at MonoTouch.ObjCRuntime.Runtime.Initialize (MonoTouch.ObjCRuntime.InitializationOptions& options) [0x00073] in /Developer/MonoTouch/Source/monotouch/src/ObjCRuntime/Runtime.cs:96 
mono-rt: Stacktrace:


mono-rt: 
Native stacktrace:


mono-rt: 	0   TimeExpenses                        0x000b4d5d mono_handle_native_sigsegv + 349

mono-rt: 	1   TimeExpenses                        0x000bfd2a sigabrt_s
ignal_handler + 122

mono-rt: 	2   libsystem_c.dylib                   0x0546e94b _sigtramp + 43

mono-rt: 	3   ???                                 0xffffffff 0x0 + 4294967295

mono-rt: 	4   libsystem_sim_c.dylib               0x05125e12 abort + 127

mono-rt: 	5   TimeExpenses                        0x00232023 monotouch_unhandled_exception_handler + 291

mono-rt: 	6   TimeExpenses                        0x000b558b mono_invoke_unhandled_exception_hook + 91

mono-rt: 	7   TimeExpenses                        0
x000b45a9 mono_h
stderr: andle_exception_internal + 3817

mono-rt: 	8   TimeExpenses                        0x000b36b9 mono_handle_exception + 41

mono-rt: 	9   TimeExpenses                        0x0005a084 altstack_handle_and_restore + 148

mono-rt: 	10  ???                                 0x0e3a4c3c 0x0 + 238701628

mono-rt: 	11  ???                                 0x0e3a4b9c 0x0 + 238701468

mono-rt: 	12  ???                                 0x0e3a39f0 0x0 + 238696944

mono-rt: 	13  ???                                 0x
0e3a3adf 0x0 + 238697183

mono-rt: 	14  TimeExpenses                        0x000e4686 mono_jit_runtime_invoke + 790

mono-rt: 	15  TimeExpenses                        0x0017ea9f mono_runtime_invoke + 127

mono-rt: 	16  TimeExpenses                        0x00222d80 monotouch_init + 1312

mono-rt: 	17  TimeExpenses                        0x0021bc22 main + 1970

mono-rt: 	18  TimeExpenses                        0x000032d5 start + 53

mono-rt: 	19  ???                                 0x00000004 0x0 + 4

mono-
rt: 
===stderr: ==============================================================
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 8 Jose Miguel Torres 2014-01-29 10:15:51 UTC
Hello,

Could you point me out at which class (or even method) are you getting this exception?

It typically means that the GC is processing an unreferenced object or has been disposed previously since there was not referenced before...

let me know, thanks,
Comment 9 Jim 2014-01-29 10:25:49 UTC
Hello Jose!

Thanks for looking into this.

You have as much info as I have
1. Run from Visual Studio (debug or non-debug)
2. See splash screen appear
3. Get the above exception in the VS output window.

None of our code is executed at all.

Allie has a copy of our source code that you can fire up in VS (she mentioned by email you guys had repro'd it).

I'm happy to give you any more info but you guys are best placed to find out more if you can repro'd.
Comment 10 Jose Miguel Torres 2014-01-29 10:27:12 UTC
Ok, let me check it out. I will let you know about that...

thank you for your patience ;-)
Comment 11 Jim 2014-01-29 10:42:23 UTC
Thanks - I shall look forward to what you find out.

BTW, I am able to run a brand new iOS app from the VS Xamarin template without any problems.  It seems a problem specific to our app.  Our app runs fine on this version of Xamarin (not the latest):

Xamarin Studio “About” on Mac

=== Xamarin Studio ===
Version 4.0.12 (build 3)
Installation UUID: defa9c6b-1804-491e-a569-1b47237c96e6
Runtime:
Mono 3.2.3 ((no/8d3b4b7)
GTK 2.24.20
GTK# (2.12.0.0)
Package version: 302030000
=== Apple Developer Tools ===
Xcode 4.6.3 (2068)
Build 4H1503
=== Xamarin.Mac ===
Xamarin.Mac: Not Installed
=== Xamarin.iOS ===
Version: 7.0.1.4 (Business Edition)
Hash: 4cfca2f
Branch:
Build date: 2013-20-09 23:14:32-0400
=== Xamarin.Android ===
Not Installed
=== Build Information ===
Release ID: 400120003
Git revision: 593d7acb1cb78ceeeb482d5133cf1fe514467e39
Build date: 2013-08-07 20:30:53+0000
Xamarin addins: 25a0858b281923e666b09259ad4746b774e0a873
=== Operating System ===
Mac OS X 10.8.5
Darwin itpcmac01.local 12.5.0 Darwin Kernel Version 12.5.0
Mon Jul 29 16:33:49 PDT 2013
root:xnu-2050.48.11~1/RELEASE_X86_64 x86_64


Visual Studio “About” on Windows

Microsoft Visual Studio Premium 2012
Version 11.0.60610.01 Update 3
Microsoft .NET Framework
Version 4.5.50709
Installed Version: Premium
Team Explorer for Visual Studio 2012 
Microsoft Team Explorer for Visual Studio 2012
Visual Basic 2012 
Microsoft Visual Basic 2012
Visual C# 2012 
Microsoft Visual C# 2012
Visual C++ 
Microsoft Visual C++ 2012
Visual F# 
Microsoft Visual F# 2012
Xamarin.iOS 1.1.200 (7d63692c)
Visual Studio extension to enable development for Xamarin.iOS
Comment 12 Jose Miguel Torres 2014-02-14 05:37:29 UTC
Finally we have found out the problem. It was that this project is referencing its own monotouch profiling files instead of the mac build host system one, as a result it may generated any kind of unexpected error. Hence marking this as RESOLVED
Comment 13 Jim 2014-02-14 05:40:28 UTC
To add to Jose's comment:

Change any references like this:
    <Reference Include="System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, processorArchitecture=MSIL">
      <HintPath>..\..\..\Dependencies\MonoTouch\v4.0\System.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>

To this:
<Reference Include="System" />