Browse Source

fix #445 - Baml Decompiler Exception: ArgumentException: Cannot find StaticResource

pull/462/head
Siegfried Pammer 12 years ago
parent
commit
8c9ec7b626
  1. 2
      ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs
  2. 11
      ILSpy.BamlDecompiler/Tests/Cases/Issue445.xaml
  3. 2
      ILSpy.BamlDecompiler/Tests/TestRunner.cs

2
ILSpy.BamlDecompiler/Ricciolo.StylesExplorer.MarkupReflection/XmlBamlReader.cs

@ -1553,7 +1553,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection @@ -1553,7 +1553,7 @@ namespace Ricciolo.StylesExplorer.MarkupReflection
object GetStaticResource(short identifier)
{
int keyIndex = currentKey - 1;
int keyIndex = Math.Max(0, currentKey - 1);
while (keyIndex >= 0 && !keys[keyIndex].HasStaticResources)
keyIndex--;
if (keyIndex >= 0 && identifier < keys[keyIndex].StaticResources.Count)

11
ILSpy.BamlDecompiler/Tests/Cases/Issue445.xaml

@ -1,17 +1,12 @@ @@ -1,17 +1,12 @@
<UserControl x:Class="BamlTest.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">
<UserControl x:Class="BamlTest.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d">
<UserControl.Resources>
<Style TargetType="Control" x:Key="baseStyle" />
<Style x:Key="baseStyle" TargetType="{x:Type Control}" />
</UserControl.Resources>
<Grid>
<Grid.ContextMenu>
<ContextMenu>
<ContextMenu.Resources>
<Style TargetType="Control" BasedOn="{StaticResource baseStyle}" />
<Style TargetType="{x:Type Control}" BasedOn="{StaticResource baseStyle}" />
</ContextMenu.Resources>
</ContextMenu>
</Grid.ContextMenu>

2
ILSpy.BamlDecompiler/Tests/TestRunner.cs

@ -79,7 +79,7 @@ namespace ILSpy.BamlDecompiler.Tests @@ -79,7 +79,7 @@ namespace ILSpy.BamlDecompiler.Tests
RunTest("cases/simplepropertyelement");
}
[Test, Ignore]
[Test]
public void Issue445()
{
RunTest("cases/issue445");

Loading…
Cancel
Save