diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XmlTests.cs b/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XmlTests.cs index 6120aff2f5..6731151cb0 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XmlTests.cs +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XmlTests.cs @@ -69,7 +69,6 @@ namespace ICSharpCode.XamlBinding.Tests } [Test] - [Ignore("Failing Test broke the build for 3 days - ignoring it. Reenable this test when the XmlParser bug is fixed!")] public void InMarkupExtensionNamedParameterTest() { string xaml = ""; diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs index 7e775da9f9..6ac77a889b 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs @@ -323,16 +323,12 @@ namespace ICSharpCode.XmlEditor // Count the number of double quotes and single quotes that exist // before the first equals sign encountered going backwards to // the start of the active element. - bool foundEqualsSign = false; int doubleQuotesCount = 0; int singleQuotesCount = 0; char lastQuoteChar = ' '; for (int i = index - 1; i > elementStartIndex; --i) { char ch = xml[i]; - if (ch == '=') { - foundEqualsSign = true; - break; - } else if (ch == '\"') { + if (ch == '\"') { lastQuoteChar = ch; ++doubleQuotesCount; } else if (ch == '\'') { @@ -341,18 +337,13 @@ namespace ICSharpCode.XmlEditor } } - bool isInside = false; - - if (foundEqualsSign) { - // Odd number of quotes? - if ((lastQuoteChar == '\"') && ((doubleQuotesCount % 2) > 0)) { - isInside = true; - } else if ((lastQuoteChar == '\'') && ((singleQuotesCount %2) > 0)) { - isInside = true; - } + // Odd number of quotes? + if ((lastQuoteChar == '\"') && ((doubleQuotesCount % 2) > 0)) { + return true; + } else if ((lastQuoteChar == '\'') && ((singleQuotesCount %2) > 0)) { + return true; } - - return isInside; + return false; } /// diff --git a/src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeValueUnderCursorTests.cs b/src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeValueUnderCursorTests.cs index 22b00ee838..bbbddb9ac9 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeValueUnderCursorTests.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeValueUnderCursorTests.cs @@ -79,6 +79,14 @@ namespace XmlEditor.Tests.Parser Assert.AreEqual("{Binding Value}", XmlParser.GetAttributeValueAtIndex(xaml, offset)); } + [Test] + public void InMarkupExtensionNamedParameterTest() + { + string xaml = ""; + int offset = "