Bug 52580 - MergedWith broken
Summary: MergedWith broken
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-16 19:15 UTC by Christian Schwarz
Modified: 2017-02-17 20:23 UTC (History)
2 users (show)

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


Attachments
MergedWithIssue (328.35 KB, application/x-zip-compressed)
2017-02-16 19:15 UTC, Christian Schwarz
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 ANSWERED

Description Christian Schwarz 2017-02-16 19:15:07 UTC
Created attachment 19850 [details]
MergedWithIssue

<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              x:Class="MergedWithIssue.Resource1">
  <Style x:Key="Temp1" TargetType="Entry">
    <Setter Property="FontSize" Value="24" />
  </Style>
</ResourceDictionary>

<?xml version="1.0" encoding="utf-8" ?>
<ResourceDictionary xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:s="clr-namespace:MergedWithIssue;assembly=MergedWithIssue"
             x:Class="MergedWithIssue.Resource2"
             MergedWith="s:Resource1">
  <Style x:Key="Temp2" TargetType="Entry">
    <Setter Property="FontSize" Value="64" />
  </Style>
</ResourceDictionary>

Resource2 resource2 = new Resource2();
bool resourceCount = resource2.Count == 2;
object style1 = resource2["Temp1"];
object style2 = resource2["Temp2"];

With Xamarin.Forms 2.3.4-pre2 resource2.Count == 1 and Temp1 is not included.

Works fine with 2.3.3.180
Comment 1 Stephane Delcroix 2017-02-17 20:12:45 UTC
This was changed on purpose to address the fact that some APIs of the RD were returning merged values, and other not.

The main purpose of ResourceDictionary is to be used with `{StaticResource}` markup extension in XAML, and we're making sure that capability keeps working fine.

We're sorry if you were relying on that in your code and if you have to spend some time (hopefully not much) changing it.
Comment 2 Stephane Delcroix 2017-02-17 20:23:05 UTC
here's the PR that modified the behavior https://github.com/xamarin/Xamarin.Forms/pull/536