| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
| 2 | |
| 3 | namespace WixToolset.Core |
| 4 | { |
| 5 | using WixToolset.Data; |
| 6 | using WixToolset.Data.Symbols; |
| 7 | |
| 8 | internal static class LinkerErrors |
| 9 | { |
| 10 | public static Message DuplicateBindPathVariableOnCommandLine(string argument, string bindName, string bindValue, string collisionValue) |
| 11 | { |
| 12 | return Message(null, Ids.DuplicateBindPathVariableOnCommandLine, "", argument, bindName, bindValue, collisionValue); |
| 13 | } |
| 14 | |
| 15 | public static Message DuplicateSymbol(IntermediateSymbol symbol) |
| 16 | { |
| 17 | return Message(symbol.SourceLineNumbers, Ids.DuplicateSymbol, "Duplicate {0} with identifier '{1}' found. Access modifiers (global, library, file, section) cannot prevent these conflicts. Ensure all your identifiers of a given type (Directory, File, etc.) are unique.", symbol.Definition.Name, symbol.Id.Id); |
| 18 | } |
| 19 | |
| 20 | public static Message DuplicateSymbol(IntermediateSymbol symbol, SourceLineNumber referencingSourceLineNumber) |
| 21 | { |
| 22 | if (referencingSourceLineNumber is null) |
| 23 | { |
| 24 | return DuplicateSymbol(symbol); |
| 25 | } |
| 26 | |
| 27 | return Message(symbol.SourceLineNumbers, Ids.DuplicateSymbol, "Duplicate {0} with identifier '{1}' referenced by {2}. Ensure all your identifiers of a given type (Directory, File, etc.) are unique or use an access modifier to scope the identfier.", symbol.Definition.Name, symbol.Id.Id, referencingSourceLineNumber); |
| 28 | } |
| 29 | |
| 30 | public static Message DuplicateVirtualSymbol(IntermediateSymbol symbol) |
| 31 | { |
| 32 | return Message(symbol.SourceLineNumbers, Ids.DuplicateSymbol, "The virtual {0} with identifier '{1}' is duplicated. Ensure identifiers of a given type (Directory, File, etc.) are unique or did you mean to make one an override for the virtual symbol?", symbol.Definition.Name, symbol.Id.Id); |
| 33 | } |
| 34 | |
| 35 | public static Message DuplicateVirtualSymbol(IntermediateSymbol symbol, SourceLineNumber referencingSourceLineNumber) |
| 36 | { |
| 37 | if (referencingSourceLineNumber is null) |
| 38 | { |
| 39 | return DuplicateVirtualSymbol(symbol); |
| 40 | } |
| 41 | |
| 42 | return Message(symbol.SourceLineNumbers, Ids.DuplicateSymbol, "The virtual {0} with identifier '{1}' is duplicated. Ensure identifiers of a given type (Directory, File, etc.) are unique or did you mean to make one an override for the virtual symbol? Referenced from {2}", symbol.Definition.Name, symbol.Id.Id, referencingSourceLineNumber); |
| 43 | } |
| 44 | |
| 45 | public static Message DuplicateSymbol2(IntermediateSymbol symbol) |
| 46 | { |
| 47 | return Message(symbol.SourceLineNumbers, Ids.DuplicateSymbol2, "Location of symbol related to previous error."); |
| 48 | } |
| 49 | |
| 50 | public static Message OrphanedPayload(SourceLineNumber sourceLineNumbers, string payloadId) |
| 51 | { |
| 52 | return Message(sourceLineNumbers, Ids.OrphanedPayload, "Found orphaned Payload '{0}'. Make sure to reference it from a Package, the BootstrapperApplication, or the Bundle or move it into its own Fragment so it only gets linked in when actually used.", payloadId); |
| 53 | } |
| 54 | |
| 55 | public static Message PackageInMultipleContainers(SourceLineNumber sourceLineNumbers, string packageId, string containerId1, string containerId2) |
| 56 | { |
| 57 | return Message(sourceLineNumbers, Ids.PackageInMultipleContainers, "The Package '{0}' is referenced from multiple containers - Container '{1}' and Container '{2}'. This is not currently supported.", packageId, containerId1, containerId2); |
| 58 | } |
| 59 | |
| 60 | public static Message PayloadSharedWithBA(SourceLineNumber sourceLineNumbers, string payloadId) |
| 61 | { |
| 62 | return Message(sourceLineNumbers, Ids.PayloadSharedWithBA, "The Payload '{0}' is shared with the BootstrapperApplication. This is not currently supported.", payloadId); |
| 63 | } |
| 64 | |
| 65 | public static Message UnscheduledChainPackage(SourceLineNumber sourceLineNumbers, string packageId) |
| 66 | { |
| 67 | return Message(sourceLineNumbers, Ids.UnscheduledChainPackage, "Found orphaned Package '{0}'. Make sure to reference it from the Chain or move it into its own Fragment so it only gets linked in when actually used.", packageId); |
| 68 | } |
| 69 | |
| 70 | public static Message UnscheduledRollbackBoundary(SourceLineNumber sourceLineNumbers, string rollbackBoundaryId) |
| 71 | { |
| 72 | return Message(sourceLineNumbers, Ids.UnscheduledRollbackBoundary, "Found orphaned RollbackBoundary '{0}'. Make sure to reference it from the Chain or move it into its own Fragment so it only gets linked in when actually used.", rollbackBoundaryId); |
| 73 | } |
| 74 | |
| 75 | public static Message BAContainerCannotContainRemotePayload(SourceLineNumber sourceLineNumbers, string payloadName) |
| 76 | { |
| 77 | return Message(sourceLineNumbers, Ids.BAContainerCannotContainRemotePayload, "Bootstrapper application and bundle extension payloads must be embedded in the bundle. The payload '{0}' is remote thus cannot be found for embedding. Provide a full path to the payload via the Payload/@SourceFile attribute.", payloadName); |
| 78 | } |
| 79 | |
| 80 | public static Message UncompressedPayloadInContainer(SourceLineNumber sourceLineNumbers, string payloadId, string containerId) |
| 81 | { |
| 82 | return Message(sourceLineNumbers, Ids.UncompressedPayloadInContainer, "The payload '{0}' is uncompressed and cannot be added to container '{1}'. Remove its Compressed attribute and provide a @SourceFile value to allow it to be added to a container.", payloadId, containerId); |
| 83 | } |
| 84 | |
| 85 | public static Message VirtualSymbolNotFoundForOverride(IntermediateSymbol symbol) |
| 86 | { |
| 87 | return Message(symbol.SourceLineNumbers, Ids.VirtualSymbolNotFoundForOverride, "Could not find a virtual symbol to override with the {0} symbol '{1}'. Remove the override access modifier or include the code with the virtual symbol.", symbol.Definition.Name, symbol.Id.Id); |
| 88 | } |
| 89 | |
| 90 | public static Message VirtualSymbolNotFoundForOverride(IntermediateSymbol symbol, SourceLineNumber referencingSourceLineNumber) |
| 91 | { |
| 92 | if (referencingSourceLineNumber is null) |
| 93 | { |
| 94 | return VirtualSymbolNotFoundForOverride(symbol); |
| 95 | } |
| 96 | |
| 97 | return Message(symbol.SourceLineNumbers, Ids.VirtualSymbolNotFoundForOverride, "Could not find a virtual symbol to override with the {0} symbol '{1}'. Remove the override access modifier or include the code with the virtual symbol. Referenced from {2}", symbol.Definition.Name, symbol.Id.Id, referencingSourceLineNumber); |
| 98 | } |
| 99 | |
| 100 | public static Message VirtualSymbolMustBeOverridden(IntermediateSymbol symbol) |
| 101 | { |
| 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); |
| 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 | |
| 110 | public static Message VirtualSymbolMustBeOverridden(IntermediateSymbol symbol, SourceLineNumber referencingSourceLineNumber) |
| 111 | { |
| 112 | if (referencingSourceLineNumber is null) |
| 113 | { |
| 114 | return VirtualSymbolMustBeOverridden(symbol); |
| 115 | } |
| 116 | |
| 117 | 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. Referenced from {2}", symbol.Definition.Name, symbol.Id.Id, referencingSourceLineNumber); |
| 118 | } |
| 119 | |
| 120 | private static Message Message(SourceLineNumber sourceLineNumber, Ids id, string format, params object[] args) |
| 121 | { |
| 122 | return new Message(sourceLineNumber, MessageLevel.Error, (int)id, format, args); |
| 123 | } |
| 124 | |
| 125 | public enum Ids |
| 126 | { |
| 127 | DuplicateSymbol = 91, |
| 128 | DuplicateSymbol2 = 92, |
| 129 | |
| 130 | OrphanedPayload = 7000, |
| 131 | PackageInMultipleContainers = 7001, |
| 132 | PayloadSharedWithBA = 7002, |
| 133 | UnscheduledChainPackage = 7003, |
| 134 | UnscheduledRollbackBoundary = 7004, |
| 135 | UncompressedPayloadInContainer = 7005, |
| 136 | BAContainerCannotContainRemotePayload = 7006, |
| 137 | DuplicateBindPathVariableOnCommandLine = 7007, |
| 138 | VirtualSymbolNotFoundForOverride = 7008, |
| 139 | VirtualSymbolMustBeOverridden = 7009, |
| 140 | } // last available is 7099. 7100 is WindowsInstallerBackendWarnings. |
| 141 | } |
| 142 | } |