Bug 41631 - Inherited Application Class not Created
Summary: Inherited Application Class not Created
Status: RESOLVED DUPLICATE of bug 18350
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 6.1.0 (C7)
Hardware: PC Windows
: --- blocker
Target Milestone: 7.0 (C8)
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2016-06-09 06:40 UTC by Christian.Wall
Modified: 2016-06-15 02:27 UTC (History)
4 users (show)

Tags: BZSRC7
Is this bug a regression?: ---
Last known good build:


Attachments
Sample App that show's the issue (11.64 KB, application/x-zip-compressed)
2016-06-09 06:41 UTC, Christian.Wall
Details


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:
Status:
RESOLVED DUPLICATE of bug 18350

Description Christian.Wall 2016-06-09 06:40:35 UTC
We have a Custom Application Class tagged with the Application Attribute. This class worked fine, means it was instantiated prior to any Activity.
After Upgrading from Cycle 6 to 7 the Class will be ignored.

# Steps to reproduce
1. Create Blank App
2. Add a custom Application Class
  [Application]
  public class MyApplication : Application
  {
    public static MyApplication Instance { get; private set; }

    protected MyApplication(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
    {
      Instance = this;
    }
  }

3. Check the MyApplication.Instance in OnCreate of the MainActivity. -> It's null

# Expected behavior

The MyApplication should be instantiated. 

# Actual behavior
With the new Release the constructor will never be called.

# Supplemental info (logs, images, videos)
n.A.

# Test environment (full version information)
Microsoft Visual Studio Enterprise 2015
Version 14.0.25123.00 Update 2

Xamarin   4.1.0.530 (2e39740)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   6.1.0.71 (4e27558)
Visual Studio extension to enable development for Xamarin.Android.

Xamarin.iOS   9.8.0.323 (39ebb77)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Christian.Wall 2016-06-09 06:41:46 UTC
Created attachment 16238 [details]
Sample App that show's the issue
Comment 2 Alek Slater 2016-06-10 09:37:19 UTC
We have the same exact issue, OnCreate is never called in my Application subclass.
Comment 3 Matt Jones 2016-06-10 10:06:59 UTC
Seems to work on the Alpha channel but not Beta or Stable right now.
Comment 4 Jonathan Pryor 2016-06-15 02:27:31 UTC

*** This bug has been marked as a duplicate of bug 18350 ***