Forum Xamarin.iOS

Strange System.NullReferenceException

I am developing an iOS MonoGame app using Visual Studio 2012. Due to problems with BugSense documented here, I want to submit my app without it. So I uninstalled the BugSense NuGet Package and removed the single reference to BugSense found in the FinishedLaunching method:


But after I rebuild and deploy again in Debug configuration, I get the following exception at UIApplication.Main (args, null, "AppDelegate");

System.NullReferenceException: Object reference not set to an instance of an object

The exception gets raised moments after the app successfully starts. If I return BugSense it goes away. Its a very weird problem and i cant guess how to fix it. I tried reproducing it in an empty project but I couldn't.


  • SebastienPouliotSebastienPouliot CAXamarin Team Xamurai

    There should be a stack trace along with the NullReferenceException. Right now there is very little data to enable us to help you.

    Beside the stack trace we'll likely need to see your initialization code, build log (with -v -v -v -v for extra verbosity) and the (symbolicated) crash report from the device.

  • RamsayAmarinRamsayAmarin JOMember
    edited September 2014

    While I did manage to find the bug by more guessing, I would like to know how to achieve the your requirments. Where do I find the build log? where exactly in VS2012 do I enter -v -v -v -v? Where do I find the crash report? I did a Google search but didnt find any detailed Xamarin documentation regrading these questions.

    Edit: I still would very much like to use BugSense in my project and I am awaiting your response to my reply (comment 3) in Bugzilla.

  • HugoCornelisHugoCornelis BEMember

    @RamsayAmarin I have the same problem as you report: null reference exception somewhere inside UIApplication.Main() but without much more information, no sensible stack information.
    Could you give me advice on how to debug this problem? Or information about how you solved your problem?

  • RamsayAmarinRamsayAmarin JOMember
    edited May 2015

    @HugoCornelis Sorry I have left this platform long ago and moved on to Unity (I do game development), so I dont remember much about this issue, but I do know that BugSense is no longer supported and it has been re-branded as Splunk MINT (bought by another company).

  • HugoCornelisHugoCornelis BEMember

    @RamsayAmarin Thanks for your answer. I had a bug in my C# code and it is unclear to me why Xamarin received the exception in the UIApplication.Main(). I tracked it down by commenting out parts of the code, and rerunning the app until I found the culprit. Solved the problem, works now.

Sign In or Register to comment.