Avoid infinite loops when resolving variables.
Bob Arnson committed
Mar 12, 2020 at 21:25 UTC
2cae81fe9d9457c395996e6f27db0d81e250e4f2
2 files changed
+2
-1
src/WixToolset.Core/VariableResolver.cs
+1
-1
@@ -94,7 +94,7 @@ namespace WixToolset.Core
94
result.IsDefault = true;
95
result.Value = value;
96
97
- while (!result.DelayedResolve && matches.Count > 0)
97
+ while (!this.Messaging.EncounteredError && !result.DelayedResolve && matches.Count > 0)
98
{
99
var sb = new StringBuilder(value);
100
src/test/WixToolsetTest.CoreIntegration/VariableResolverFixture.cs
+1
@@ -32,6 +32,7 @@ namespace WixToolsetTest.CoreIntegration
32
Assert.Equal("Welcome to Localized Product Name", variableResolver.ResolveVariables(null, "Welcome to !(loc.ProductName)", false).Value);
33
Assert.Equal("Welcome to Localized Product Name Enterprise Edition", variableResolver.ResolveVariables(null, "Welcome to !(loc.ProductNameEdition)", false).Value);
34
Assert.Equal("Welcome to Localized Product Name Enterprise Edition v1.2.3", variableResolver.ResolveVariables(null, "Welcome to !(loc.ProductNameEditionVersion)", false).Value);
35
+ Assert.Throws<WixException>(() => variableResolver.ResolveVariables(null, "Welcome to !(loc.UnknownLocalizationVariable)", false));
36
}
37
}
38
}