Correctly pass extension context when Id attribute is null
Rob Mensching committed
Jun 4, 2020 at 10:28 UTC
110bfc5b5bfee7c4592d9898406d2250f3c96ca3
4 files changed
+9
-9
src/WixToolset.Core/Compiler.cs
+2
-2
@@ -2416,7 +2416,7 @@ namespace WixToolset.Core
2416
}
2417
else
2418
{
2419
- var context = new Dictionary<string, string>() { { "ComponentId", id.Id }, { "DirectoryId", directoryId }, { "Win64", win64.ToString() }, };
2419
+ var context = new Dictionary<string, string>() { { "ComponentId", id?.Id }, { "DirectoryId", directoryId }, { "Win64", win64.ToString() }, };
2420
var possibleKeyPath = this.Core.ParsePossibleKeyPathExtensionElement(node, child, context);
2421
if (null != possibleKeyPath)
2422
{
@@ -5753,7 +5753,7 @@ namespace WixToolset.Core
5753
}
5754
else
5755
{
5756
- var context = new Dictionary<string, string>() { { "FileId", id.Id }, { "ComponentId", componentId }, { "DirectoryId", directoryId }, { "Win64", win64Component.ToString() } };
5756
+ var context = new Dictionary<string, string>() { { "FileId", id?.Id }, { "ComponentId", componentId }, { "DirectoryId", directoryId }, { "Win64", win64Component.ToString() } };
5757
this.Core.ParseExtensionElement(node, child, context);
5758
}
5759
}
src/WixToolset.Core/Compiler_2.cs
+3
-3
@@ -1794,7 +1794,7 @@ namespace WixToolset.Core
1794
}
1795
else
1796
{
1797
- var context = new Dictionary<string, string>() { { "RegistryId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } };
1797
+ var context = new Dictionary<string, string>() { { "RegistryId", id?.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } };
1798
this.Core.ParseExtensionElement(node, child, context);
1799
}
1800
}
@@ -1991,7 +1991,7 @@ namespace WixToolset.Core
1991
}
1992
else
1993
{
1994
- var context = new Dictionary<string, string>() { { "RegistryId", id.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } };
1994
+ var context = new Dictionary<string, string>() { { "RegistryId", id?.Id }, { "ComponentId", componentId }, { "Win64", win64Component.ToString() } };
1995
this.Core.ParseExtensionElement(node, child, context);
1996
}
1997
}
@@ -3658,7 +3658,7 @@ namespace WixToolset.Core
3658
}
3659
else
3660
{
3661
- var context = new Dictionary<string, string>() { { "ServiceInstallId", id.Id }, { "ServiceInstallName", name }, { "ServiceInstallComponentId", componentId }, { "Win64", win64Component.ToString() } };
3661
+ var context = new Dictionary<string, string>() { { "ServiceInstallId", id?.Id }, { "ServiceInstallName", name }, { "ServiceInstallComponentId", componentId }, { "Win64", win64Component.ToString() } };
3662
this.Core.ParseExtensionElement(node, child, context);
3663
}
3664
}
src/WixToolset.Core/Compiler_Bundle.cs
+3
-3
@@ -949,7 +949,7 @@ namespace WixToolset.Core
949
var id = this.ParsePayloadElementContent(node, parentType, parentId, previousType, previousId, true);
950
var context = new Dictionary<string, string>
951
{
952
- ["Id"] = id.Id
952
+ ["Id"] = id?.Id
953
};
954
955
foreach (var child in node.Elements())
@@ -1044,7 +1044,7 @@ namespace WixToolset.Core
1044
// Now that the PayloadId is known, we can parse the extension attributes.
1045
var context = new Dictionary<string, string>
1046
{
1047
- ["Id"] = id.Id
1047
+ ["Id"] = id?.Id
1048
};
1049
1050
foreach (var extensionAttribute in extensionAttributes)
@@ -2070,7 +2070,7 @@ namespace WixToolset.Core
2070
}
2071
else
2072
{
2073
- var context = new Dictionary<string, string>() { { "Id", id.Id } };
2073
+ var context = new Dictionary<string, string>() { { "Id", id?.Id } };
2074
this.Core.ParseExtensionElement(node, child, context);
2075
}
2076
}
src/test/WixToolsetTest.CoreIntegration/BadInputFixture.cs
+1
-1
@@ -10,7 +10,7 @@ namespace WixToolsetTest.CoreIntegration
10
11
public class BadInputFixture
12
{
13
- [Fact(Skip = "Test demonstrates failure")]
13
+ [Fact]
14
public void RegistryKeyWithoutAttributesDoesntCrash()
15
{
16
var folder = TestData.Get(@"TestData\BadInput");