Bug 32510 - Resource dictionary not working as expected
Summary: Resource dictionary not working as expected
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.4
Hardware: PC Mac OS
: Normal critical
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-27 18:40 UTC by Cody Beyer (MSFT)
Modified: 2015-08-19 09:23 UTC (History)
7 users (show)

Tags: ac
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:
Status:
RESOLVED ANSWERED

Description Cody Beyer (MSFT) 2015-07-27 18:40:15 UTC
### Descirption

The following sample demonstrates an issue where dictionary Application.Current.Resources is reset to null after certain events are raised

### Sample

https://www.dropbox.com/s/gr3vyb9f6r6b06f/ResourceTesting.zip?dl=0

### Steps to Reproduce

1. Download sample
2. Run on iOS Simulator
3. But a breakpoint in the SelectionsPage constructor
4. Put a break point in the Control_ItemSelected event
5. Set a watch for Application.Current.Resources
6. Run
7. Look at watch at breakpoint hit from step 3
8. Look at watch at breakpoint hit from step 4

### Expected Results

Application.Current.Resources should not be null at step 8

### Actual Results

Application.Current.Resources is set to null after event at step 8

### Versions

=== Xamarin Studio ===

Version 5.9.5 (build 6)
Installation UUID: 14e9db9d-4a59-440f-8c5b-890f54ec8c58
Runtime:
	Mono 4.0.3 ((detached/e4f44c1)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030019

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

Version: 8.10.4.27 (Business Edition)
Hash: 7cf6633
Branch: master
Build date: 2015-07-21 16:27:35-0400

=== Xamarin.Android ===

Version: 5.1.5.3 (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	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)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

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

=== Xamarin.Mac ===

Version: 2.0.2.102 (Business Edition)

=== Build Information ===

Release ID: 509050006
Git revision: c50b1022a6b36f9b2a55beb7814b87811d1dba52
Build date: 2015-07-16 18:13:13-04
Xamarin addins: 6571e3228ff9e432a98b468630ec5ffd35f2f6b3

=== Operating System ===

Mac OS X 10.10.4
Darwin Codys-Macintosh.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 1 Udham Singh 2015-08-06 08:48:08 UTC
I have checked this issue with the help of test steps given in bug description and able to reproduce the reported behaviour. Please refer the screencast : http://www.screencast.com/t/hXub3yKLwyhT

Ide Log : https://gist.github.com/Udham1/d32f5a18416550102272
Application Output : https://gist.github.com/Udham1/27f5bc5be18c9ddfbd16
Build Output : https://gist.github.com/Udham1/24b1d5f9c8b1f377c53d
System Log : https://gist.github.com/Udham1/9f2c4d944056ae127c6d

Environment Info : 

Xamarin.Forms version : 1.4.4.6392 

=== Xamarin Studio ===

Version 5.9.5 (build 9)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 4.0.3 ((detached/d6946b4)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400030020

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: 8.10.4.45 (Business Edition)
Hash: b94bc00
Branch: master
Build date: 2015-08-04 15:26:49-0400

=== Xamarin.Mac ===

Version: 2.0.2.122 (Business Edition)

=== Xamarin.Android ===

Version: 5.1.5.3 (Business Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
	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: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

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

=== Build Information ===

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

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 Rui Marinho 2015-08-18 18:30:19 UTC
Hi, so this issue is this line:

> var pageController = page.CreateViewController();

Calling CreateViewController extension method should be used only to set the main page of the application, this method is around to be compatible with previous versions of XF. 

As a workaround for what this particular issue you could try this, but take in mind this is not supported.

page.Parent = Xamarin.Forms.Application.Current;
var pageController = page.CreateViewController();
Comment 3 Greg Dickie 2015-08-19 09:23:43 UTC
Hi Rui,

Would you be able to give me an example of how I could accomplish opening a dialog on an iPad with the ModalPresentationStyle and ModalTransitionStyle properties set? I don't really want to do anything that isn't supported or I'll run into things like this issue in the future.

Having the ability to set these two properties when using ShowModalDialog would solve my problems and reduce complexity but as far as I know that isn't available.

Thanks,

Greg