@joebigelow / wix-1 / commits / e6f381b0

Tolerate missing RegistryValue/@Value when @Type="binary".

Bob Arnson committed Nov 4, 2019 at 13:15 UTC e6f381b0ce2011ced88697ca7ddaae8a053b57d7
3 files changed +4 -2
src/WixToolset.Core/Compiler_2.cs
+2 -2
@@ -2006,11 +2006,11 @@ namespace WixToolset.Core
2006 //}
2007
2008 // value may be set by child MultiStringValue elements, so it must be checked here
2009 - if (null == value)
2009 + if (null == value && valueType != RegistryValueType.Binary)
2010 {
2011 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Value"));
2012 }
2013 - else if (0 == value.Length && ("+" == name || "-" == name || "*" == name)) // prevent accidental authoring of special name values
2013 + else if (0 == value?.Length && ("+" == name || "-" == name || "*" == name)) // prevent accidental authoring of special name values
2014 {
2015 this.Core.Write(ErrorMessages.RegistryNameValueIncorrect(sourceLineNumbers, node.Name.LocalName, "Name", name));
2016 }
src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
+1
@@ -610,6 +610,7 @@ namespace WixToolsetTest.CoreIntegration
610 var results = Query.QueryDatabase(msiPath, new[] { "Registry" });
611 Assert.Equal(new[]
612 {
613 + "Registry:reg04OIwIchl.9ZTjisTT6NzGSsQSM\t2\tPath\\To\\AnotherKey\tSecret\t#x\tMiscComponent",
614 "Registry:regEblTuusqFNSUQNy88zaP_UA5kIY\t2\tPath\\To\\Key\t\t1.0.1234.123\tMiscComponent",
615 }, results);
616 }
src/test/WixToolsetTest.CoreIntegration/TestData/Registry/RegistryValue.wxs
+1
@@ -4,6 +4,7 @@
4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 <Component Id="MiscComponent" Guid="7C40C257-AB36-4B8C-8FD1-C56E0AC4AAEF">
6 <RegistryValue Root="HKLM" Key="Path\To\Key" Value="1.0.1234.123" Type="string" KeyPath="yes" />
7 + <RegistryValue Root="HKLM" Key="Path\To\AnotherKey" Name="Secret" Type="binary" />
8 </Component>
9 </ComponentGroup>
10 </Fragment>