Bug 28742 - ChildFragmentManager returns null
Summary: ChildFragmentManager returns null
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 5.1
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2015-04-03 13:08 UTC by David Ortinau [MSFT]
Modified: 2017-02-18 14:28 UTC (History)
2 users (show)

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


Attachments
Alexandra Environment (1.35 KB, text/plain)
2015-04-27 12:16 UTC, David Ortinau [MSFT]
Details
Dave Environment (1.46 KB, text/plain)
2015-04-27 12:17 UTC, David Ortinau [MSFT]
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

Description David Ortinau [MSFT] 2015-04-03 13:08:30 UTC
Updated Alpha to 5.1 this morning and can't find any mention that this was a breaking change. In a Fragment I call:

LogoDateTimeView = this.ChildFragmentManager.FindFragmentById<LogoDateTimeView>(Resource.Id.LogoDateTimeViewMenu);

which now returns null. 

this.FragmentManager works.

Was this an intentional change?


My details:

=== Xamarin Studio ===

Version 5.9 (build 388)
Installation UUID: 89b6d01c-6671-4dc0-af25-78eba7a1514b
Runtime:
	Mono 4.0.0 ((detached/21d849b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000121

=== Xamarin.Android ===

Version: 5.1.0.100 (Business Edition)
Android SDK: /Users/dave/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		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)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: 8.10.0.197 (Business Edition)
Hash: 4dac6bf
Branch: master
Build date: 2015-04-01 21:55:11-0400

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 509000388
Git revision: 027c5efa6f92249fd2e614535965159c0a7c0fe6
Build date: 2015-04-01 19:12:53-04
Xamarin addins: a6779639267bbe31df3fd6958be4ecae82665b7e

=== Operating System ===

Mac OS X 10.10.2
Darwin RMBP-2.local 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Comment 1 Jonathan Pryor 2015-04-03 16:03:19 UTC
> Was this an intentional change?

Depends on why its failing. :-)

My guess is that it's due to changing the minSdkVersion default:

http://developer.xamarin.com/releases/android/xamarin.android_5/xamarin.android_5.1/#Change_minSdkVersion_Default_Value

Please try bumping the minSdkVersion value to match your $(TargetFrameworkVersion). If that works, please let me know.
Comment 2 David Ortinau [MSFT] 2015-04-03 16:20:47 UTC
Thanks Jon. My min and target are both API21.

https://www.dropbox.com/s/y8pvn6sa0mqslqk/Screenshot%202015-04-03%2015.18.35.png?dl=0

I updated my Android SDKs to make sure I have latest b/c Android designer is crashing XS like crazy. 

It didn't solve that nor this null issue.
Comment 3 Jonathan Pryor 2015-04-03 16:44:07 UTC
Please provide a sample so that I can more easily poke around.

Thanks!
Comment 4 David Ortinau [MSFT] 2015-04-25 00:02:21 UTC
I built out a sample project, but of course it doesn't demonstrate the problem. I introduced Mvx and I'm still not able to reproduce it. 

I'm still observing the problem in my project, but it's not a blocker.

I'll post back if I can isolate a good condition to reproduce it for you in a sample.
Comment 5 David Ortinau [MSFT] 2015-04-25 00:25:06 UTC
Ok, this project should show ChildFragmentManager failing, but FragmentManager succeeding when using the current Alpha channel.

https://github.com/davidortinau/childfragbug

2 branches, master and mvx. Both show the sample result.

Using the Stable channel, both succeed.

https://www.dropbox.com/s/x47jpsvlqnddlit/Screenshot%202015-04-24%2023.16.06.png?dl=0

Thanks
Comment 6 David Ortinau [MSFT] 2015-04-27 12:16:09 UTC
This is really strange, I have 2 seemingly identical environments. One only works with ChildFragmentManager and the other only works with FragmentManager on the same line.

I'm attaching both of our details. One is Indie and the other Enterprise. Both running stable channel. Same Android SDKs best I can tell.

Any clue what might be causing this disparity?

The code in question is simply this, an MvxFragment getting a reference to a child fragment in the OnCreateView. 

LogoDateTimeView = (LogoDateTimeView)ChildFragmentManager.FindFragmentById(Resource.Id.LogoDateTimeViewMenu);
Comment 7 David Ortinau [MSFT] 2015-04-27 12:16:56 UTC
Created attachment 10921 [details]
Alexandra Environment
Comment 8 David Ortinau [MSFT] 2015-04-27 12:17:11 UTC
Created attachment 10922 [details]
Dave Environment