Insights.Initialize(string) is obsolete: Insights must be initialized from a platform specific assem

KeithBoyntonKeithBoynton Keith BoyntonGBMember ✭✭

I've migrated a project which used the old Xamarin.Insights implementation that supported Xamarin.Insights.Initialize(string, string, string); to a Unified Xamarin.Mac Modern project.

I've added the Xamarin.Insights version 1.12.3 Nuget package.

At first I was receiving an error that there was no Initialize method that received 3 parameters so I've changed the code to the following:

public class MainClass
    {
        static void Main(string[] args)
        {
            Xamarin.Insights.Initialize ("MyKey");

            // Dump any exceptions that make it all the way up the stack
            AppDomain.CurrentDomain.UnhandledException += delegate (object sender, UnhandledExceptionEventArgs e) {
                // We're going to just have to dump this exception
                var exception = (Exception)e.ExceptionObject;
                HandleUncaughtException (exception);
            };

            // Run the App and try to catch exceptions
            try
            {
                NSApplication.Init();
                NSApplication.Main(args);
            }
            catch (Exception ex)
            {
                HandleUncaughtException(ex);
            }
        }

        static void ApplicationThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            HandleUncaughtException(e.Exception);
        }

        static void HandleUncaughtException(Exception exception)
        {
            Xamarin.Insights.Report (exception);
        }
    }

I now get the following error when trying to build:
Main.cs(13,13): Error CS0619: 'Insights.Initialize(string)' is obsolete: 'Insights must be initialized from a platform specific assembly'

As far as I can tell it is being initialized from a platform specific assembly but I could be missing something..?

Posts

  • KeithBoyntonKeithBoynton Keith Boynton GBMember ✭✭

    This is very easy to replicate, I just created a simple Xamarin.Mac modern cocoa application. I added the Insights Nuget package then added this line of code to the Main class file and the same error is given.

    Xamarin.Insights.Initialize ("MyKey");

    I've attached the simple project that illustrates the problem.

  • KeithBoyntonKeithBoynton Keith Boynton GBMember ✭✭

    It does appear that Xamarin.Mac is left out in the cold regarding Insights/HockeyApp targeted at the modern framework but I'd rather be proved wrong and it be me that's missing something.

    Is there nobody from Xamarin that can comment? Has anyone from Xamarin looked at the simple project I provided that illustrates the Insights issue?

Sign In or Register to comment.