Stack Overflow Error in Xamarin Android app's OnCreate

时间:2017-04-24 17:32:46

标签: xamarin.android

I just ran into a weird problem. I have a Xamarin Android app, which I just reorganized slightly: I added a Portable Class Library to the solution, and I moved the business classes into that new library. After launching, though, the app now crashes at startup, and the output reports a stack overflow because the OnCreate method of MyApplication calls a native n_onCreate method, which in turns calls MyApplication.OnCreate.

I'm sincerely puzzled. I made no changes to the OnCreate method, nor to any part of the MyApplication class, and I have no idea where this infinite call loop could come from. Any hint is greatly appreciated.

EDIT

MyApplication inherits from Application, overrides OnCreate and the OnCreate method calls base.OnCreate. Here it is:

public override void OnCreate()
{
    base.OnCreate();

    MobileBarcodeScanner.Initialize(this);
}

I also tried to decorate the method with

[Android.Runtime.Register("onCreate", "()V", "GetOnCreateHandler")]

to no avail.

0 个答案:

没有答案