Skip to content

Commit

Permalink
fix icsharpcode#445 - Baml Decompiler Exception: ArgumentException: C…
Browse files Browse the repository at this point in the history
…annot find StaticResource
  • Loading branch information
siegfriedpammer committed Apr 18, 2014
1 parent 5056946 commit 8c9ec7b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ void ReadPropertyWithStaticResourceIdentifier()

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)
Expand Down
11 changes: 3 additions & 8 deletions ILSpy.BamlDecompiler/Tests/Cases/Issue445.xaml
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
2 changes: 1 addition & 1 deletion ILSpy.BamlDecompiler/Tests/TestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void SimplePropertyElement()
RunTest("cases/simplepropertyelement");
}

[Test, Ignore]
[Test]
public void Issue445()
{
RunTest("cases/issue445");
Expand Down

0 comments on commit 8c9ec7b

Please sign in to comment.