From 85deb61f666f6817c1a137ace4d666c8ae2940fb Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 19 Dec 2020 14:41:19 -0600 Subject: 4862 - Disallow Burn Variables that are Hidden and Persisted. --- src/WixToolset.Core/Compiler_Bundle.cs | 5 +++++ .../BadInputFixture.cs | 23 ++++++++++++++++++++++ .../TestData/BadInput/BundleVariable.wxs | 3 +-- .../BadInput/HiddenPersistedBundleVariable.wxs | 6 ++++++ .../WixToolsetTest.CoreIntegration.csproj | 1 + 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/HiddenPersistedBundleVariable.wxs (limited to 'src') diff --git a/src/WixToolset.Core/Compiler_Bundle.cs b/src/WixToolset.Core/Compiler_Bundle.cs index 0817aef3..86fec16e 100644 --- a/src/WixToolset.Core/Compiler_Bundle.cs +++ b/src/WixToolset.Core/Compiler_Bundle.cs @@ -3178,6 +3178,11 @@ namespace WixToolset.Core this.Core.Write(ErrorMessages.ReservedNamespaceViolation(sourceLineNumbers, node.Name.LocalName, "Name", "Wix")); } + if (hidden && persisted) + { + this.Core.Write(ErrorMessages.IllegalAttributeValueWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Hidden", "yes", "Persisted")); + } + var type = this.ValidateVariableTypeWithValue(sourceLineNumbers, node, typeValue, value); this.Core.ParseForExtensionElements(node); diff --git a/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs index 7a630a36..02422cf7 100644 --- a/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs @@ -55,5 +55,28 @@ namespace WixToolsetTest.CoreIntegration Assert.Equal(21, result.ExitCode); } } + + [Fact] + public void BundleVariableWithHiddenPersistedIsRejected() + { + var folder = TestData.Get(@"TestData\BadInput"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "HiddenPersistedBundleVariable.wxs"), + "-intermediateFolder", intermediateFolder, + "-o", wixlibPath, + }); + + Assert.Equal(193, result.ExitCode); + } + } } } diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/BundleVariable.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/BundleVariable.wxs index 293b379f..a2d49b18 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/BundleVariable.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/BundleVariable.wxs @@ -1,6 +1,5 @@ - + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/HiddenPersistedBundleVariable.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/HiddenPersistedBundleVariable.wxs new file mode 100644 index 00000000..5ebe5472 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadInput/HiddenPersistedBundleVariable.wxs @@ -0,0 +1,6 @@ + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 8680bb8a..a38e89ce 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -21,6 +21,7 @@ + -- cgit v1.2.3-55-g6feb