Bug 7934 - In MfA 4.2.8, Application.OnCreate doesn't get called anymore
Summary: In MfA 4.2.8, Application.OnCreate doesn't get called anymore
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.2.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2012-10-23 01:20 UTC by Patrick
Modified: 2012-11-15 12:52 UTC (History)
5 users (show)

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 or GitHub 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:

Description Patrick 2012-10-23 01:20:58 UTC
After upgrading MfA to v4.2.8, the Application.OnCreate doesn't fire anymore.

Simple test to confirm this bug

1. Create a new Mono for Android Application project
2. Add a new class to the project, I call it App.cs
3. Inherit the class from Application and add in the [Application] attribute

    public class App : Application
        public override void OnCreate()

4. Put a breakpoint on base.OnCreate() in the App.cs
5. Put a breakpoint inside OnCreate() in the Activity1.cs

6. Debug the app.
7. You will see that the Application.OnCreate does not get fired at all
   (in fact, even the constructor for the application doesn't get called)

This used to work in MfA 4.2.7
Comment 2 Jonathan Pryor 2012-10-24 16:38:51 UTC
Fixed in master/fc97eee1, monodroid-4.2-series/c373e7f0.
Comment 3 Jonathan Pryor 2012-11-15 12:52:14 UTC
The workaround is to set the ApplicationAttribute.Name property:

    public class App : Application {
        // ...