Bug 33159 - Call to constructor returning null value
Summary: Call to constructor returning null value
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 5.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2015-08-17 12:58 UTC by arkh
Modified: 2017-09-19 16:18 UTC (History)
3 users (show)

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


Attachments
Sample Project (18.04 KB, application/octet-stream)
2015-08-19 08:10 UTC, Abhishek
Details
Correct Sample Project (18.05 KB, application/octet-stream)
2015-08-19 08:19 UTC, Abhishek
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 INVALID

Comment 1 Abhishek 2015-08-18 14:20:45 UTC
I have tried this issue and able to reproduce the reported behavior at my end.

Steps To Reproduce:
1. Create an Xamarin.Form PCL application.
2. Add Content Page
3. Copy the above code in Content Page.
4. Set the Content page to Main Page.
5. Run the application on Device/Emulator.

Could you please provide the sample project along with bug so that i can reproduce the reported behavior at my end.Also provide the IDE log, Adb Logcat and Environment Info. 

IDE log via Help->Open Log Directory.
Environment Info via->About->Show Details.

Environment Info:

=== Xamarin Studio ===

Version 5.9.5 (build 9)
Installation UUID: 9964a087-9af9-4da0-aa20-07ca4b85f306
Runtime:
	Microsoft .NET 4.0.30319.42000
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

=== Xamarin.Android ===

Version: 5.1.5 (Enterprise Edition)
Android SDK: D:\android-sdk
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_71
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

=== Xamarin Android Player ===

Version: 0.4.4
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe

=== Build Information ===

Release ID: 509050009
Git revision: b99cb19a1d3b15d8980c4616f13f837457e5b292
Build date: 2015-07-28 02:41:02-04
Xamarin addins: d53d6eceb828422f3d4aff8547f2f6bab6c9ea58

=== Operating System ===

Windows 6.1.7601.65536 (64-bit)
Comment 2 Abhishek 2015-08-18 14:21:54 UTC
An Update to above issue.
I am unable to reproduce the reported behavior at my end.
Comment 3 Jonathan Pryor 2015-08-18 21:27:07 UTC
> the following code results in SimplePage  being null:

Are you making that determination within the debugger?

If so, do you see the same behavior if you use e.g. Console.WriteLine() to verify that the value is null?

Do you also see the same behavior if the SimplePage variables have *different* names, e.g.:

    button.Clicked += async (object sender, EventArgs e) => {                
        if (someCondition) {
            SimplePage a = new SimplePage(id,false);
        }
        else {
            SimplePage b = new SimplePage(id,true);
        }
    };
Comment 4 Abhishek 2015-08-19 08:10:16 UTC
Created attachment 12569 [details]
Sample Project

As per Comment 3, I have checked this issue again but getting the same behavior at my end.

Screencast: http://www.screencast.com/t/p4gO55eec
Ide Log: https://gist.github.com/Abhishekk360/f57374312e0069a19b70
Android Device Log: https://gist.github.com/Abhishekk360/5baa060db783a2ea737f

I am also attaching my sample project. Please have a look.

Environment Info:

=== Xamarin Studio ===

Version 5.9.5 (build 9)
Installation UUID: 9964a087-9af9-4da0-aa20-07ca4b85f306
Runtime:
	Microsoft .NET 4.0.30319.42000
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

=== Xamarin.Android ===

Version: 5.1.5 (Enterprise Edition)
Android SDK: D:\android-sdk
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_71
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) Client VM (build 24.71-b01, mixed mode, sharing)

=== Xamarin Android Player ===

Version: 0.4.4
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe

=== Build Information ===

Release ID: 509050009
Git revision: b99cb19a1d3b15d8980c4616f13f837457e5b292
Build date: 2015-07-28 02:41:02-04
Xamarin addins: d53d6eceb828422f3d4aff8547f2f6bab6c9ea58

=== Operating System ===

Windows 6.1.7601.65536 (64-bit)
Comment 5 Abhishek 2015-08-19 08:19:57 UTC
Created attachment 12570 [details]
Correct Sample Project

An update to comment 4.
By mistake I have uploaded wrong sample.So correct sample is here.

Thanks.
Comment 6 Jon Douglas [MSFT] 2017-09-19 16:18:41 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.