aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2024-02-03 22:52:23 -0500
committerBob Arnson <github@bobs.org>2024-02-05 09:18:49 -0500
commiteb2f85d7ee5ad5c91af0943ffe936ee8ccfdab0d (patch)
tree8091380699b20d139f36539eac5061af24a03078
parentbf1e74b78ebe345908c3cb09280194798f63835a (diff)
downloadwix-eb2f85d7ee5ad5c91af0943ffe936ee8ccfdab0d.tar.gz
wix-eb2f85d7ee5ad5c91af0943ffe936ee8ccfdab0d.tar.bz2
wix-eb2f85d7ee5ad5c91af0943ffe936ee8ccfdab0d.zip
Improve error when virtual action symbols collide.
-rw-r--r--src/ext/Util/test/WixToolsetTest.Util/TestData/CloseApplication/Package.wxs14
-rw-r--r--src/wix/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs11
-rw-r--r--src/wix/WixToolset.Core/LinkerErrors.cs6
3 files changed, 25 insertions, 6 deletions
diff --git a/src/ext/Util/test/WixToolsetTest.Util/TestData/CloseApplication/Package.wxs b/src/ext/Util/test/WixToolsetTest.Util/TestData/CloseApplication/Package.wxs
index 8e054256..8dba33b4 100644
--- a/src/ext/Util/test/WixToolsetTest.Util/TestData/CloseApplication/Package.wxs
+++ b/src/ext/Util/test/WixToolsetTest.Util/TestData/CloseApplication/Package.wxs
@@ -1,4 +1,4 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> 1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
2 <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> 2 <Package Name="MsiPackage" Language="1033" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
3 <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> 3 <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" />
4 4
@@ -7,11 +7,15 @@
7 </Feature> 7 </Feature>
8 8
9 <util:CloseApplication Id="CloseMyApp" CloseMessage="yes" Property="MYAPPISRUNNING" Target="explorer.exe" /> 9 <util:CloseApplication Id="CloseMyApp" CloseMessage="yes" Property="MYAPPISRUNNING" Target="explorer.exe" />
10
11 <InstallExecuteSequence>
12 <Custom Action="override Wix4CloseApplications_$(sys.BUILDARCHSHORT)" After="InstallInitialize" />
13 </InstallExecuteSequence>
10 </Package> 14 </Package>
11 15
12 <Fragment> 16 <Fragment>
13 <StandardDirectory Id="ProgramFilesFolder"> 17 <StandardDirectory Id="ProgramFilesFolder">
14 <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> 18 <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
15 </StandardDirectory> 19 </StandardDirectory>
16 </Fragment> 20 </Fragment>
17</Wix> 21</Wix>
diff --git a/src/wix/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs b/src/wix/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs
index 2851fa60..b1db46a2 100644
--- a/src/wix/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs
+++ b/src/wix/WixToolset.Core/Link/ReportConflictingSymbolsCommand.cs
@@ -5,6 +5,7 @@ namespace WixToolset.Core.Link
5 using System.Collections.Generic; 5 using System.Collections.Generic;
6 using System.Linq; 6 using System.Linq;
7 using WixToolset.Data; 7 using WixToolset.Data;
8 using WixToolset.Data.Symbols;
8 using WixToolset.Extensibility.Services; 9 using WixToolset.Extensibility.Services;
9 10
10 internal class ReportConflictingSymbolsCommand 11 internal class ReportConflictingSymbolsCommand
@@ -62,7 +63,15 @@ namespace WixToolset.Core.Link
62 63
63 reportDuplicates = virtualConflicts; 64 reportDuplicates = virtualConflicts;
64 65
65 this.Messaging.Write(LinkerErrors.VirtualSymbolMustBeOverridden(first.Symbol, referencingSourceLineNumber)); 66 switch (first.Symbol)
67 {
68 case WixActionSymbol action:
69 this.Messaging.Write(LinkerErrors.VirtualSymbolMustBeOverridden(action));
70 break;
71 default:
72 this.Messaging.Write(LinkerErrors.VirtualSymbolMustBeOverridden(first.Symbol, referencingSourceLineNumber));
73 break;
74 }
66 } 75 }
67 else 76 else
68 { 77 {
diff --git a/src/wix/WixToolset.Core/LinkerErrors.cs b/src/wix/WixToolset.Core/LinkerErrors.cs
index c234087e..ab30e8c6 100644
--- a/src/wix/WixToolset.Core/LinkerErrors.cs
+++ b/src/wix/WixToolset.Core/LinkerErrors.cs
@@ -3,6 +3,7 @@
3namespace WixToolset.Core 3namespace WixToolset.Core
4{ 4{
5 using WixToolset.Data; 5 using WixToolset.Data;
6 using WixToolset.Data.Symbols;
6 7
7 internal static class LinkerErrors 8 internal static class LinkerErrors
8 { 9 {
@@ -101,6 +102,11 @@ namespace WixToolset.Core
101 return Message(symbol.SourceLineNumbers, Ids.VirtualSymbolMustBeOverridden, "The {0} symbol '{1}' conflicts with a virtual symbol. Use the 'override' access modifier to override the virtual symbol or use a different Id to avoid the conflict.", symbol.Definition.Name, symbol.Id.Id); 102 return Message(symbol.SourceLineNumbers, Ids.VirtualSymbolMustBeOverridden, "The {0} symbol '{1}' conflicts with a virtual symbol. Use the 'override' access modifier to override the virtual symbol or use a different Id to avoid the conflict.", symbol.Definition.Name, symbol.Id.Id);
102 } 103 }
103 104
105 public static Message VirtualSymbolMustBeOverridden(WixActionSymbol actionSymbol)
106 {
107 return Message(actionSymbol.SourceLineNumbers, Ids.VirtualSymbolMustBeOverridden, "The action '{0}' conflicts with a virtual symbol with the same id. To override the virtual symbol (e.g., to reschedule a custom action), use the 'override' access modifier: 'override {0}'. If you didn't intend to override a virtual symbol, use a different id to avoid the conflict.", actionSymbol.Action);
108 }
109
104 public static Message VirtualSymbolMustBeOverridden(IntermediateSymbol symbol, SourceLineNumber referencingSourceLineNumber) 110 public static Message VirtualSymbolMustBeOverridden(IntermediateSymbol symbol, SourceLineNumber referencingSourceLineNumber)
105 { 111 {
106 if (referencingSourceLineNumber is null) 112 if (referencingSourceLineNumber is null)