From bb40dc8a911ec0679016cbbf7132ea813ea1a3ad Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Mon, 19 Apr 2021 15:50:24 -0700 Subject: Detect duplicate CacheIds Fixes wixtoolset/issues#4628 --- src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs | 27 ++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs') diff --git a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs index 5ddb6be1..37fc17f9 100644 --- a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs +++ b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs @@ -359,7 +359,6 @@ namespace WixToolset.Core.Burn this.BackendHelper.ResolveDelayedFields(this.DelayedFields, variableCache); } - Dictionary dependencySymbolsByKey; { var command = new ProcessDependencyProvidersCommand(this.Messaging, section, facades); command.Execute(); @@ -368,7 +367,6 @@ namespace WixToolset.Core.Burn { bundleSymbol.ProviderKey = command.BundleProviderKey; // set the overridable bundle provider key. } - dependencySymbolsByKey = command.DependencySymbolsByKey; } // Update the bundle per-machine/per-user scope based on the chained packages. @@ -381,6 +379,13 @@ namespace WixToolset.Core.Burn command.Execute(); } + this.DetectDuplicateCacheIds(facades); + + if (this.Messaging.EncounteredError) + { + return; + } + // Give the extension one last hook before generating the output files. foreach (var extension in this.BackendExtensions) { @@ -581,6 +586,24 @@ namespace WixToolset.Core.Burn } } + private void DetectDuplicateCacheIds(IDictionary facades) + { + var duplicateCacheIdDetector = new Dictionary(); + + foreach (var facade in facades.Values) + { + if (duplicateCacheIdDetector.TryGetValue(facade.PackageSymbol.CacheId, out var collisionPackage)) + { + this.Messaging.Write(BurnBackendErrors.DuplicateCacheIds(collisionPackage.SourceLineNumbers, facade.PackageSymbol.CacheId)); + this.Messaging.Write(BurnBackendErrors.DuplicateCacheIds2(facade.PackageSymbol.SourceLineNumbers, facade.PackageSymbol.CacheId)); + } + else + { + duplicateCacheIdDetector.Add(facade.PackageSymbol.CacheId, facade.PackageSymbol); + } + } + } + private IEnumerable GetRequiredSymbols() where T : IntermediateSymbol { var symbols = this.Output.Sections.Single().Symbols.OfType().ToList(); -- cgit v1.2.3-55-g6feb