Ensure a CustomAction source is provided
Fixes 7139
Rob Mensching committed
Jan 12, 2023 at 08:47 UTC
bcb75416e20cc16d85fc2c0e44a8fd78449f3b3c
2 files changed
+17
-10
src/wix/WixToolset.Core/Compiler.cs
+6
-1
@@ -3502,11 +3502,16 @@ namespace WixToolset.Core
3502
this.Core.Write(ErrorMessages.IllegalPropertyCustomActionAttributes(sourceLineNumbers));
3503
}
3504
3505
- if (!targetType.HasValue /*0 == targetBits*/)
3505
+ if (!targetType.HasValue)
3506
{
3507
this.Core.Write(ErrorMessages.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "DllEntry", "Error", "ExeCommand", "JScriptCall", "Script", "Value", "VBScriptCall"));
3508
}
3509
3510
+ if (!sourceType.HasValue)
3511
+ {
3512
+ this.Core.Write(ErrorMessages.ExpectedAttributes(sourceLineNumbers, node.Name.LocalName, "BinaryRef", "Directory", "Error", "FileRef", "Property", "Script"));
3513
+ }
3514
+
3515
this.Core.ParseForExtensionElements(node);
3516
3517
if (!this.Core.EncounteredError)
src/wix/test/WixToolsetTest.Converters/CustomActionFixture.cs
+11
-9
@@ -18,19 +18,21 @@ namespace WixToolsetTest.Converters
18
var parse = String.Join(Environment.NewLine,
19
"<?xml version='1.0' encoding='utf-8'?>",
20
"<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
21
- " <CustomAction Id='Foo' BinaryKey='WixCA' DllEntry='CAQuietExec' />",
22
- " <CustomAction Id='Foo' BinaryKey='WixCA_x64' DllEntry='CAQuietExec64' />",
23
- " <CustomAction Id='Foo' BinaryKey='UtilCA' DllEntry='WixQuietExec' />",
24
- " <CustomAction Id='Foo' BinaryKey='UtilCA_x64' DllEntry='WixQuietExec64' />",
21
+ " <CustomAction Id='Foo1' BinaryKey='WixCA' DllEntry='CAQuietExec' />",
22
+ " <CustomAction Id='Foo2' BinaryKey='WixCA_x64' DllEntry='CAQuietExec64' />",
23
+ " <CustomAction Id='Foo3' BinaryKey='UtilCA' DllEntry='WixQuietExec' />",
24
+ " <CustomAction Id='Foo4' BinaryKey='UtilCA_x64' DllEntry='WixQuietExec64' />",
25
+ " <CustomAction Id='Foo5' BinaryKey='WixCA' DllEntry='CAQuietExec64' Execute='deferred' Return='check' Impersonate='no' />",
26
"</Wix>");
27
28
var expected = new[]
29
{
30
"<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
30
- " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec\" BinaryRef=\"Wix4UtilCA_X86\" />",
31
- " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec64\" BinaryRef=\"Wix4UtilCA_X64\" />",
32
- " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec\" BinaryRef=\"Wix4UtilCA_X86\" />",
33
- " <CustomAction Id=\"Foo\" DllEntry=\"WixQuietExec64\" BinaryRef=\"Wix4UtilCA_X64\" />",
31
+ " <CustomAction Id=\"Foo1\" DllEntry=\"WixQuietExec\" BinaryRef=\"Wix4UtilCA_X86\" />",
32
+ " <CustomAction Id=\"Foo2\" DllEntry=\"WixQuietExec64\" BinaryRef=\"Wix4UtilCA_X64\" />",
33
+ " <CustomAction Id=\"Foo3\" DllEntry=\"WixQuietExec\" BinaryRef=\"Wix4UtilCA_X86\" />",
34
+ " <CustomAction Id=\"Foo4\" DllEntry=\"WixQuietExec64\" BinaryRef=\"Wix4UtilCA_X64\" />",
35
+ " <CustomAction Id=\"Foo5\" DllEntry=\"WixQuietExec64\" Execute=\"deferred\" Return=\"check\" Impersonate=\"no\" BinaryRef=\"Wix4UtilCA_X86\" />",
36
"</Wix>",
37
};
38
@@ -43,8 +45,8 @@ namespace WixToolsetTest.Converters
45
46
var actual = UnformattedDocumentLines(document);
47
46
- Assert.Equal(11, errors);
48
WixAssert.CompareLineByLine(expected, actual);
49
+ Assert.Equal(14, errors);
50
}
51
52
[Fact]