@joebigelow / wix-1 / commits / 099a5bc8

Introduce Message attribute to remove Error inner text

Rob Mensching committed Jun 17, 2020 at 12:11 UTC 099a5bc83bfde2a713a94d47e613dba16fdcee2a
2 files changed +12 -5
src/WixToolset.Core/Compiler.cs
+10 -1
@@ -5358,6 +5358,7 @@ namespace WixToolset.Core
5358 {
5359 var sourceLineNumbers = Preprocessor.GetSourceLineNumbers(node);
5360 var id = CompilerConstants.IntegerNotSet;
5361 + string message = null;
5362
5363 foreach (var attrib in node.Attributes())
5364 {
@@ -5368,6 +5369,9 @@ namespace WixToolset.Core
5369 case "Id":
5370 id = this.Core.GetAttributeIntegerValue(sourceLineNumbers, attrib, 0, Int16.MaxValue);
5371 break;
5372 + case "Message":
5373 + message = this.Core.GetAttributeValue(sourceLineNumbers, attrib, EmptyRule.CanBeEmpty);
5374 + break;
5375 default:
5376 this.Core.UnexpectedAttribute(node, attrib);
5377 break;
@@ -5385,13 +5389,18 @@ namespace WixToolset.Core
5389 id = CompilerConstants.IllegalInteger;
5390 }
5391
5392 + if (String.IsNullOrEmpty(message))
5393 + {
5394 + message = Common.GetInnerText(node);
5395 + }
5396 +
5397 this.Core.ParseForExtensionElements(node);
5398
5399 if (!this.Core.EncounteredError)
5400 {
5401 this.Core.AddTuple(new ErrorTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, id))
5402 {
5394 - Message = Common.GetInnerText(node)
5403 + Message = message
5404 });
5405 }
5406 }
src/test/WixToolsetTest.CoreIntegration/TestData/ErrorsInUI/PackageComponents.wxs
+2 -4
@@ -2,10 +2,8 @@
2 <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <UI>
5 - <Error Id="1234">
6 - Category 55 Emergency Doomsday Crisis
7 - </Error>
8 - <Error Id="5678"><![CDATA[ ]]></Error>
5 + <Error Id="1234" Message="Category 55 Emergency Doomsday Crisis" />
6 + <Error Id="5678" Message=" " />
7 </UI>
8 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
9 <Component>