diff options
author | Bob Arnson <bob@firegiant.com> | 2022-08-14 23:56:32 -0400 |
---|---|---|
committer | Bob Arnson <github@bobs.org> | 2022-08-15 23:19:55 -0400 |
commit | da5cc586114e537461b239a882c5bbea470d812d (patch) | |
tree | 071c2b90693435e2593b06b950c4cb87b7c43999 | |
parent | 91b8fb6f3215e9e652ac036f756dec383267adad (diff) | |
download | wix-da5cc586114e537461b239a882c5bbea470d812d.tar.gz wix-da5cc586114e537461b239a882c5bbea470d812d.tar.bz2 wix-da5cc586114e537461b239a882c5bbea470d812d.zip |
Clean up error message when BA is missing.
Fixes https://github.com/wixtoolset/issues/issues/6852.
4 files changed, 47 insertions, 14 deletions
diff --git a/src/api/wix/WixToolset.Data/ErrorMessages.cs b/src/api/wix/WixToolset.Data/ErrorMessages.cs index bb0bdaab..40378a2e 100644 --- a/src/api/wix/WixToolset.Data/ErrorMessages.cs +++ b/src/api/wix/WixToolset.Data/ErrorMessages.cs | |||
@@ -1425,9 +1425,9 @@ namespace WixToolset.Data | |||
1425 | return Message(sourceLineNumbers, Ids.MergePlatformMismatch, "'{0}' is a 64-bit merge module but the product consuming it is 32-bit. 32-bit products can consume only 32-bit merge modules.", mergeModuleFile); | 1425 | return Message(sourceLineNumbers, Ids.MergePlatformMismatch, "'{0}' is a 64-bit merge module but the product consuming it is 32-bit. 32-bit products can consume only 32-bit merge modules.", mergeModuleFile); |
1426 | } | 1426 | } |
1427 | 1427 | ||
1428 | public static Message MissingBundleInformation(string data) | 1428 | public static Message MissingBundleInformation(string friendlyName) |
1429 | { | 1429 | { |
1430 | return Message(null, Ids.MissingBundleInformation, "The Bundle is missing '{0}' data, and cannot continue.", data); | 1430 | return Message(null, Ids.MissingBundleInformation, "The Bundle is missing {0} data, and cannot continue.", friendlyName); |
1431 | } | 1431 | } |
1432 | 1432 | ||
1433 | public static Message MissingBundleSearch(SourceLineNumber sourceLineNumbers, string searchId) | 1433 | public static Message MissingBundleSearch(SourceLineNumber sourceLineNumbers, string searchId) |
diff --git a/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs b/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs index 45718031..75a080a8 100644 --- a/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs +++ b/src/wix/WixToolset.Core.Burn/Bind/BindBundleCommand.cs | |||
@@ -96,9 +96,7 @@ namespace WixToolset.Core.Burn | |||
96 | var wixGroupSymbols = this.GetRequiredSymbols<WixGroupSymbol>(); | 96 | var wixGroupSymbols = this.GetRequiredSymbols<WixGroupSymbol>(); |
97 | 97 | ||
98 | // Ensure there is one and only one WixBundleSymbol. | 98 | // Ensure there is one and only one WixBundleSymbol. |
99 | // The compiler and linker behavior should have colluded to get | 99 | var bundleSymbol = this.GetSingleSymbol<WixBundleSymbol>("bundle"); |
100 | // this behavior. | ||
101 | var bundleSymbol = this.GetSingleSymbol<WixBundleSymbol>(); | ||
102 | 100 | ||
103 | bundleSymbol.ProviderKey = bundleSymbol.BundleId = Guid.NewGuid().ToString("B").ToUpperInvariant(); | 101 | bundleSymbol.ProviderKey = bundleSymbol.BundleId = Guid.NewGuid().ToString("B").ToUpperInvariant(); |
104 | 102 | ||
@@ -107,14 +105,10 @@ namespace WixToolset.Core.Burn | |||
107 | this.NormalizeRelatedBundles(bundleSymbol, section); | 105 | this.NormalizeRelatedBundles(bundleSymbol, section); |
108 | 106 | ||
109 | // Ensure there is one and only one WixBootstrapperApplicationDllSymbol. | 107 | // Ensure there is one and only one WixBootstrapperApplicationDllSymbol. |
110 | // The compiler and linker behavior should have colluded to get | 108 | var bundleApplicationDllSymbol = this.GetSingleSymbol<WixBootstrapperApplicationDllSymbol>("bootstrapper application"); |
111 | // this behavior. | ||
112 | var bundleApplicationDllSymbol = this.GetSingleSymbol<WixBootstrapperApplicationDllSymbol>(); | ||
113 | 109 | ||
114 | // Ensure there is one and only one WixChainSymbol. | 110 | // Ensure there is one and only one WixChainSymbol. |
115 | // The compiler and linker behavior should have colluded to get | 111 | var chainSymbol = this.GetSingleSymbol<WixChainSymbol>("package chain"); |
116 | // this behavior. | ||
117 | var chainSymbol = this.GetSingleSymbol<WixChainSymbol>(); | ||
118 | 112 | ||
119 | if (this.Messaging.EncounteredError) | 113 | if (this.Messaging.EncounteredError) |
120 | { | 114 | { |
@@ -317,7 +311,7 @@ namespace WixToolset.Core.Burn | |||
317 | if (0 == uxPayloadIndex) | 311 | if (0 == uxPayloadIndex) |
318 | { | 312 | { |
319 | // If we didn't get any UX payloads, it's an error! | 313 | // If we didn't get any UX payloads, it's an error! |
320 | throw new WixException(ErrorMessages.MissingBundleInformation("BootstrapperApplication")); | 314 | throw new WixException(ErrorMessages.MissingBundleInformation("bootstrapper application")); |
321 | } | 315 | } |
322 | 316 | ||
323 | // Give the embedded payloads without an embedded id yet an embedded id. | 317 | // Give the embedded payloads without an embedded id yet an embedded id. |
@@ -691,13 +685,13 @@ namespace WixToolset.Core.Burn | |||
691 | return symbols; | 685 | return symbols; |
692 | } | 686 | } |
693 | 687 | ||
694 | private T GetSingleSymbol<T>() where T : IntermediateSymbol | 688 | private T GetSingleSymbol<T>(string elementName) where T : IntermediateSymbol |
695 | { | 689 | { |
696 | var symbols = this.Output.Sections.Single().Symbols.OfType<T>().ToList(); | 690 | var symbols = this.Output.Sections.Single().Symbols.OfType<T>().ToList(); |
697 | 691 | ||
698 | if (1 != symbols.Count) | 692 | if (1 != symbols.Count) |
699 | { | 693 | { |
700 | throw new WixException(ErrorMessages.MissingBundleInformation(typeof(T).Name)); | 694 | throw new WixException(ErrorMessages.MissingBundleInformation(elementName)); |
701 | } | 695 | } |
702 | 696 | ||
703 | return symbols[0]; | 697 | return symbols[0]; |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs index c7dd4cfa..8b65e4aa 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs | |||
@@ -730,5 +730,37 @@ namespace WixToolsetTest.CoreIntegration | |||
730 | Assert.Equal(7004, result.ExitCode); | 730 | Assert.Equal(7004, result.ExitCode); |
731 | } | 731 | } |
732 | } | 732 | } |
733 | |||
734 | [Fact] | ||
735 | public void CannotBuildWithMissingBootstrapperApplication() | ||
736 | { | ||
737 | var folder = TestData.Get(@"TestData"); | ||
738 | |||
739 | using (var fs = new DisposableFileSystem()) | ||
740 | { | ||
741 | var baseFolder = fs.GetFolder(); | ||
742 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
743 | var exePath = Path.Combine(baseFolder, @"bin\test.exe"); | ||
744 | |||
745 | try | ||
746 | { | ||
747 | WixRunner.Execute(new[] | ||
748 | { | ||
749 | "build", | ||
750 | Path.Combine(folder, "BundleWithInvalid", "BundleWithMissingBA.wxs"), | ||
751 | "-bindpath", Path.Combine(folder, ".Data"), | ||
752 | "-intermediateFolder", intermediateFolder, | ||
753 | "-o", exePath, | ||
754 | }); | ||
755 | } | ||
756 | catch (WixException we) | ||
757 | { | ||
758 | Assert.Equal(341, we.Error.Id); | ||
759 | return; | ||
760 | } | ||
761 | |||
762 | Assert.False(true, "Expected exception not accepted."); | ||
763 | } | ||
764 | } | ||
733 | } | 765 | } |
734 | } | 766 | } |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithMissingBA.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithMissingBA.wxs new file mode 100644 index 00000000..e663f055 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/BundleWithInvalid/BundleWithMissingBA.wxs | |||
@@ -0,0 +1,7 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
2 | <Bundle Name="BundleWithMissingBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="B94478B1-E1F3-4700-9CE8-6AA090854AEC"> | ||
3 | <Chain> | ||
4 | <ExePackage DetectCondition="DetectedSomething" UninstallArguments="-uninstall" SourceFile="burn.exe" /> | ||
5 | </Chain> | ||
6 | </Bundle> | ||
7 | </Wix> | ||