Ensure Errors have ids so they can be referenced.
Bob Arnson committed
Jan 6, 2020 at 14:54 UTC
69651a71ff2fdc1e9897b878782d79dcc1f9b896
3 files changed
+10
-1
src/WixToolset.Core/Compiler.cs
+1
-1
@@ -5297,7 +5297,7 @@ namespace WixToolset.Core
5297
5298
if (!this.Core.EncounteredError)
5299
{
5300
- var tuple = new ErrorTuple(sourceLineNumbers)
5300
+ var tuple = new ErrorTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, id))
5301
{
5302
Error = id,
5303
Message = Common.GetInnerText(node)
src/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
+6
@@ -280,6 +280,12 @@ namespace WixToolsetTest.CoreIntegration
280
var errors = section.Tuples.OfType<ErrorTuple>().ToDictionary(t => t.Error);
281
Assert.Equal("Category 55 Emergency Doomsday Crisis", errors[1234].Message.Trim());
282
Assert.Equal(" ", errors[5678].Message);
283
+
284
+ var customAction1 = section.Tuples.OfType<CustomActionTuple>().Where(t => t.Id.Id == "CanWeReferenceAnError_YesWeCan").Single();
285
+ Assert.Equal("1234", customAction1.Target);
286
+
287
+ var customAction2 = section.Tuples.OfType<CustomActionTuple>().Where(t => t.Id.Id == "TextErrorsWorkOKToo").Single();
288
+ Assert.Equal("If you see this, something went wrong.", customAction2.Target);
289
}
290
}
291
src/test/WixToolsetTest.CoreIntegration/TestData/ErrorsInUI/Package.wxs
+3
@@ -6,6 +6,9 @@
6
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
7
<MediaTemplate />
8
9
+ <CustomAction Id="CanWeReferenceAnError_YesWeCan" Error="1234" />
10
+ <CustomAction Id="TextErrorsWorkOKToo" Error="If you see this, something went wrong." />
11
+
12
<Feature Id="ProductFeature" Title="!(loc.FeatureTitle)">
13
<ComponentGroupRef Id="ProductComponents" />
14
</Feature>