Skip to content

Crashes when distributing for Xamarin.Mac #37

@KeithBoynton

Description

@KeithBoynton

Implemented very well into Windows, Xamarin.iOS and Xamarin.Mac and everything is working really well in Debug within Visual Studio.

However when I come to package up and distribute, it crashes on the distributed version with the following stack trace:

Crashed Thread:        0  tid_307  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [497]

Thread 0 Crashed:: tid_307  Dispatch queue: com.apple.main-thread
0   com.xxxxx.xxxxxxxxxxx         	0x000000010d7b005d eglib_log_adapter + 13 (mono-logger.c:404)
1   com.xxxxx.xxxxxxxxxxx         	0x000000010d7ca26e monoeg_g_logv_nofree + 190 (goutput.c:150)
2   com.xxxxx.xxxxxxxxxxx         	0x000000010d7ca3ef monoeg_assertion_message + 143 (goutput.c:184)
3   com.xxxxx.xxxxxxxxxxx         	0x000000010d5a8a69 mono_jit_thread_attach + 169
4   com.xxxxx.xxxxxxxxxxx         	0x000000010d4bd5a0 xamarin_switch_gchandle + 144 (runtime.m:1853)
5   com.xxxxx.xxxxxxxxxxx         	0x000000010d4c0217 xamarin_release_trampoline + 103 (trampolines.m:474)
6   libobjc.A.dylib               	0x0000000119a3711a (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 710
7   com.xxxxx.xxxxxxxxxxx         	0x000000010d4c79c2 xamarin_main + 1234 (launcher.m:674)
8   com.xxxxx.xxxxxxxxxxx         	0x000000010d4c8834 main + 36 (launcher.m:679)
9   libdyld.dylib                 	0x000000011a4ec3d5 start + 1

I understand you have listed Xamarin.Mac as "partial" support but I assumed as I've gotten everything running nicely within Visual Studio in Xamarin.Mac I wasn't touching any of the unsupported elements.

I've wrapped it in a static class...

using Plugin.GoogleAnalytics;

namespace Core.Analytics
{
 public static class AppClient
    {
        public static void Initialise()
        {
            GoogleAnalytics.Current.Config.TrackingId = "XXX";
            GoogleAnalytics.Current.Config.AppId = "XXX";
            GoogleAnalytics.Current.Config.AppName = "XXX";
            GoogleAnalytics.Current.Config.AppVersion = "XXX";
            GoogleAnalytics.Current.Config.AppInstallerId = "XXX";
            GoogleAnalytics.Current.Config.StartMessage = "Startup";
            GoogleAnalytics.Current.Tracker.DataSource = "app";

#if __MACOS__
            GoogleAnalytics.Current.Tracker.UserAgentOverride = $"Mozilla/5.0 (Mac OS {Environment.OSVersion.Version.Major}.{Environment.OSVersion.Version.Minor}; Trident/7.0; rv:11.0) like Geko";
#endif

            GoogleAnalytics.Current.InitTracker();
        }
    }
}

And I call it from my app logic....


// Set up analytics
LogWriter.Info ("Setting up analytics");
Analytics.AppClient.Initialise();
LogWriter.Info ("Done");

The Analytics.AppClient.Initialise(); line is where it crashes. The "Setting up analytics" logging gets written but not the "Done" line.

I'm guessing this isn't expected, is there anything special needed to distribute or does that crash indicate anything to you?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions