From 8a67cff70cdfa014cc068dcc7756ed57b2ed1642 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Tue, 8 Dec 2020 14:00:13 -0500 Subject: Decompiling null GUID should set `Guid=""` to match. --- .../Decompile/Decompiler.cs | 2 +- .../DecompileFixture.cs | 6 ++++++ .../TestData/DecompileNullComponent/Expected.wxs | 18 ++++++++++++++++++ .../TestData/DecompileNullComponent/example.cab | Bin 0 -> 137 bytes .../TestData/DecompileNullComponent/example.msi | Bin 0 -> 32768 bytes .../WixToolsetTest.CoreIntegration.csproj | 3 +++ 6 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/Expected.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.cab create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.msi (limited to 'src') diff --git a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs index 80ee75a5..d11a890c 100644 --- a/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs +++ b/src/WixToolset.Core.WindowsInstaller/Decompile/Decompiler.cs @@ -4152,7 +4152,7 @@ namespace WixToolset.Core.WindowsInstaller { var xComponent = new XElement(Names.ComponentElement, new XAttribute("Id", row.FieldAsString(0)), - row.IsColumnEmpty(1) ? null : new XAttribute("Guid", row.FieldAsString(1))); + new XAttribute("Guid", row.FieldAsString(1) ?? String.Empty)); var attributes = row.FieldAsInteger(3); diff --git a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs index 15082f2b..b07f5bda 100644 --- a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs @@ -72,5 +72,11 @@ namespace WixToolsetTest.CoreIntegration { DecompileAndCompare(@"TestData\Shortcut", "shortcuts.msi", "DecompiledShortcuts.wxs"); } + + [Fact] + public void CanDecompileNullComponent() + { + DecompileAndCompare(@"TestData\DecompileNullComponent", "example.msi", "Expected.wxs"); + } } } diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/Expected.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/Expected.wxs new file mode 100644 index 00000000..89592150 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/Expected.wxs @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.cab b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.cab new file mode 100644 index 00000000..125eeb2c Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.cab differ diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.msi new file mode 100644 index 00000000..81335041 Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/DecompileNullComponent/example.msi differ diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 8e5a005c..6c494169 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -207,6 +207,9 @@ + + + -- cgit v1.2.3-55-g6feb