160 references to BadImageFormatException
BuildValidator (1)
PEReaderExtensions.cs (1)
114
throw new
BadImageFormatException
("Failed to convert invalid RVA to offset: " + rva);
Microsoft.Build.Tasks.Core (2)
AssemblyDependency\AssemblyInformation.cs (1)
466
throw new
BadImageFormatException
(string.Format(CultureInfo.CurrentCulture,
AssemblyDependency\ReferenceTable.cs (1)
2908
throw new
BadImageFormatException
(ResourceUtilities.GetResourceString("ResolveAssemblyReference.ImplementationDllHasInvalidPEHeader"));
Microsoft.Build.Tasks.UnitTests (2)
AssemblyDependency\ResolveAssemblyReferenceTestFixture.cs (2)
1078
throw new System.
BadImageFormatException
(@"The format of the file '" + Path.Combine(s_myVersion20Path, "BadImage.dll") + "' is invalid");
1441
throw new
BadImageFormatException
("X.pdb is a PDB file, not a managed assembly");
Microsoft.CodeAnalysis (7)
MetadataReader\MetadataReaderExtensions.cs (5)
106
throw new
BadImageFormatException
(string.Format(CodeAnalysisResources.InvalidAssemblyName, nameStr));
112
throw new
BadImageFormatException
(string.Format(CodeAnalysisResources.InvalidCultureName, cultureName));
125
throw new
BadImageFormatException
(CodeAnalysisResources.InvalidPublicKey);
133
throw new
BadImageFormatException
(CodeAnalysisResources.InvalidPublicKeyToken);
146
throw new
BadImageFormatException
(CodeAnalysisResources.InvalidPublicKey);
MetadataReader\PEModule.cs (2)
262
throw new
BadImageFormatException
(CodeAnalysisResources.PEImageDoesntContainManagedMetadata);
395
throw new
BadImageFormatException
(string.Format(CodeAnalysisResources.InvalidModuleName, this.Name, moduleName));
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
ExpressionCompiler.cs (1)
84
throw new
BadImageFormatException
(error);
Microsoft.CodeAnalysis.Test.Utilities (5)
Metadata\DynamicAnalysisDataReader.cs (5)
307
throw new
BadImageFormatException
(string.Format("Invalid document name", separator));
346
throw new
BadImageFormatException
("SequencePointValueOutOfRange");
357
throw new
BadImageFormatException
("SequencePointValueOutOfRange");
368
throw new
BadImageFormatException
("SequencePointValueOutOfRange");
379
throw new
BadImageFormatException
("Invalid handle");
System.Private.CoreLib (34)
src\libraries\System.Private.CoreLib\src\System\Reflection\Assembly.cs (1)
262
throw new
BadImageFormatException
(SR.BadImageFormat_BadILFormat);
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.Core.cs (2)
88
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResType_SerBlobMismatch, type.FullName, graph.GetType().FullName));
188
throw new
BadImageFormatException
(SR.BadImageFormat_InvalidType);
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (21)
188
throw new
BadImageFormatException
(SR.BadImageFormat_NegativeStringLength);
343
throw new
BadImageFormatException
(SR.BadImageFormat_NegativeStringLength);
352
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesNameTooLong);
368
throw new
BadImageFormatException
(SR.BadImageFormat_ResourceNameCorrupted);
391
throw new
BadImageFormatException
(SR.BadImageFormat_NegativeStringLength);
397
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourcesIndexTooLong, index));
708
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
715
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
722
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
736
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
748
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
762
throw new
BadImageFormatException
(SR.BadImageFormat_TypeMismatch);
817
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
852
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
860
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
902
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
923
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
934
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
950
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
959
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
975
throw new
BadImageFormatException
(SR.BadImageFormat_InvalidType);
src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\AssemblyLoadContext.cs (2)
388
throw new
BadImageFormatException
(SR.BadImageFormat_BadILFormat);
424
throw new
BadImageFormatException
(SR.BadImageFormat_BadILFormat);
src\System\Reflection\RuntimeCustomAttributeData.cs (5)
681
throw new
BadImageFormatException
(SR.Arg_CustomAttributeFormatException);
733
throw new
BadImageFormatException
(SR.Arg_CustomAttributeFormatException);
744
throw new
BadImageFormatException
(SR.Arg_CustomAttributeFormatException);
794
throw new
BadImageFormatException
(SR.Arg_CustomAttributeUnknownNamedArgument);
799
throw new
BadImageFormatException
(SR.Arg_CustomAttributeDuplicateNamedArgument);
src\System\Reflection\RuntimeParameterInfo.cs (3)
60
throw new
BadImageFormatException
(SR.BadImageFormat_ParameterSignatureMismatch);
75
throw new
BadImageFormatException
(SR.BadImageFormat_ParameterSignatureMismatch);
83
throw new
BadImageFormatException
(SR.BadImageFormat_ParameterSignatureMismatch);
System.Reflection.Metadata (74)
System\Reflection\Metadata\BlobReader.cs (2)
349
throw new
BadImageFormatException
(SR.ValueTooLarge);
697
throw new
BadImageFormatException
(SR.InvalidConstantValue);
System\Reflection\Metadata\Ecma335\CustomAttributeDecoder.cs (1)
419
_ => throw new
BadImageFormatException
(SR.NotTypeDefOrRefHandle),
System\Reflection\Metadata\Ecma335\MetadataAggregator.cs (1)
226
throw new
BadImageFormatException
(SR.EnCMapNotSorted);
System\Reflection\Metadata\Ecma335\SignatureDecoder.cs (6)
130
throw new
BadImageFormatException
(SR.Format(SR.UnexpectedSignatureTypeCode, typeCode));
145
throw new
BadImageFormatException
(SR.SignatureTypeSequenceMustHaveAtLeastOneElement);
316
throw new
BadImageFormatException
(SR.NotTypeDefOrRefHandle);
328
throw new
BadImageFormatException
(SR.NotTypeDefOrRefOrSpecHandle);
335
throw new
BadImageFormatException
(SR.Format(SR.UnexpectedSignatureHeader, expectedKind, header.Kind, header.RawValue));
344
throw new
BadImageFormatException
(SR.Format(SR.UnexpectedSignatureHeader2, SignatureKind.Property, SignatureKind.Method, header.Kind, header.RawValue));
System\Reflection\Metadata\IL\MethodBodyBlock.cs (4)
121
throw new
BadImageFormatException
(SR.Format(SR.InvalidMethodHeader1, headByte));
128
throw new
BadImageFormatException
(SR.Format(SR.InvalidMethodHeader2, headByte, headByte2));
149
throw new
BadImageFormatException
(SR.Format(SR.InvalidLocalSignatureToken, unchecked((uint)localSignatureToken)));
162
throw new
BadImageFormatException
(SR.Format(SR.InvalidSehHeader, sehHeader));
System\Reflection\Metadata\Internal\BlobHeap.cs (1)
193
throw new
BadImageFormatException
(SR.InvalidDocumentName);
System\Reflection\Metadata\MetadataReader.cs (23)
136
throw new
BadImageFormatException
(SR.Format(SR.ModuleTableInvalidNumberOfRows, this.ModuleTable.NumberOfRows));
182
throw new
BadImageFormatException
(SR.MetadataHeaderTooSmall);
188
throw new
BadImageFormatException
(SR.MetadataSignature);
203
throw new
BadImageFormatException
(SR.NotEnoughSpaceForVersionString);
246
throw new
BadImageFormatException
(SR.StreamHeaderTooSmall);
256
throw new
BadImageFormatException
(SR.NotEnoughSpaceForStreamHeaderName);
281
throw new
BadImageFormatException
(SR.NotEnoughSpaceForStringStream);
290
throw new
BadImageFormatException
(SR.NotEnoughSpaceForBlobStream);
299
throw new
BadImageFormatException
(SR.NotEnoughSpaceForGUIDStream);
308
throw new
BadImageFormatException
(SR.NotEnoughSpaceForBlobStream);
317
throw new
BadImageFormatException
(SR.NotEnoughSpaceForMetadataStream);
327
throw new
BadImageFormatException
(SR.NotEnoughSpaceForMetadataStream);
337
throw new
BadImageFormatException
(SR.NotEnoughSpaceForMetadataStream);
347
throw new
BadImageFormatException
(SR.NotEnoughSpaceForMetadataStream);
361
throw new
BadImageFormatException
(SR.InvalidMetadataStreamFormat);
436
throw new
BadImageFormatException
(SR.MetadataTableHeaderTooSmall);
467
throw new
BadImageFormatException
(SR.Format(SR.UnknownTables, presentTables));
478
throw new
BadImageFormatException
(SR.IllegalTablesInCompressedMetadataStream);
503
throw new
BadImageFormatException
(SR.TableRowCountSpaceTooSmall);
509
throw new
BadImageFormatException
(SR.Format(SR.InvalidRowCount, rowCount));
539
throw new
BadImageFormatException
(SR.Format(SR.InvalidEntryPointToken, entryPointToken));
549
throw new
BadImageFormatException
(SR.Format(SR.UnknownTables, externalTableMask));
781
throw new
BadImageFormatException
(SR.MetadataTablesTooSmall);
System\Reflection\Metadata\MetadataReader.WinMD.cs (1)
658
throw new
BadImageFormatException
(SR.WinMDMissingMscorlibRef);
System\Reflection\Metadata\PEReaderExtensions.cs (1)
34
throw new
BadImageFormatException
(SR.Format(SR.InvalidMethodRva, relativeVirtualAddress));
System\Reflection\Metadata\PortablePdb\ImportDefinitionCollection.cs (1)
123
throw new
BadImageFormatException
(SR.Format(SR.InvalidImportDefinitionKind, kind));
System\Reflection\Metadata\TypeSystem\TypeDefinition.cs (1)
150
throw new
BadImageFormatException
(SR.InvalidTypeSize);
System\Reflection\PortableExecutable\PEHeader.cs (1)
289
throw new
BadImageFormatException
(SR.UnknownPEMagicValue);
System\Reflection\PortableExecutable\PEHeaders.cs (9)
96
throw new
BadImageFormatException
(SR.InvalidPESignature);
107
throw new
BadImageFormatException
(SR.UnknownFileFormat);
256
throw new
BadImageFormatException
(SR.InvalidCorHeaderSize);
281
throw new
BadImageFormatException
(SR.UnknownFileFormat);
301
throw new
BadImageFormatException
(SR.InvalidPESignature);
311
throw new
BadImageFormatException
(SR.InvalidNumberOfSections);
347
throw new
BadImageFormatException
(SR.SectionTooSmall);
414
throw new
BadImageFormatException
(SR.MissingDataDirectory);
425
throw new
BadImageFormatException
(SR.InvalidMetadataSectionSpan);
System\Reflection\PortableExecutable\PEReader.cs (5)
548
throw new
BadImageFormatException
(SR.InvalidDirectoryRVA);
553
throw new
BadImageFormatException
(SR.InvalidDirectorySize);
572
throw new
BadImageFormatException
(SR.InvalidDebugDirectoryEntryCharacteristics);
627
throw new
BadImageFormatException
(SR.UnexpectedCodeViewDataSignature);
666
throw new
BadImageFormatException
(SR.InvalidPdbChecksumDataFormat);
System\Reflection\PortableExecutable\PEReader.EmbeddedPortablePdb.cs (5)
58
throw new
BadImageFormatException
(SR.Format(SR.UnsupportedFormatVersion, PortablePdbVersions.Format(formatVersion)));
64
throw new
BadImageFormatException
(SR.Format(SR.UnsupportedFormatVersion, PortablePdbVersions.Format(embeddedBlobVersion)));
76
throw new
BadImageFormatException
(SR.UnexpectedEmbeddedPortablePdbDataSignature);
117
throw new
BadImageFormatException
(SR.SizeMismatch);
126
throw new
BadImageFormatException
(SR.SizeMismatch);
System\Reflection\Throw.cs (12)
155
throw new
BadImageFormatException
(SR.OutOfBoundsRead);
167
throw new
BadImageFormatException
(SR.InvalidCodedIndex);
173
throw new
BadImageFormatException
(SR.InvalidHandle);
179
throw new
BadImageFormatException
(SR.InvalidCompressedInteger);
185
throw new
BadImageFormatException
(SR.InvalidSerializedString);
191
throw new
BadImageFormatException
(SR.ImageTooSmall);
197
throw new
BadImageFormatException
(SR.ImageTooSmallOrContainsInvalidOffsetOrCount);
203
throw new
BadImageFormatException
(SR.RowIdOrHeapOffsetTooLarge);
209
throw new
BadImageFormatException
(SR.Format(SR.MetadataTableNotSorted, tableIndex));
227
throw new
BadImageFormatException
(SR.TooManySubnamespaces);
233
throw new
BadImageFormatException
(SR.ValueTooLarge);
239
throw new
BadImageFormatException
(SR.SequencePointValueOutOfRange);
System.Reflection.MetadataLoadContext (7)
System\Reflection\MetadataLoadContext.Loading.cs (1)
27
throw new
BadImageFormatException
(SR.NoMetadataInPeImage);
System\Reflection\TypeLoading\General\Ecma\EcmaHelpers.cs (1)
77
throw new
BadImageFormatException
(SR.Format(SR.UnexpectedUnderlyingEnumType, enumType, type));
System\Reflection\TypeLoading\General\Ecma\EcmaResolver.cs (2)
105
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_TypeRefModuleNotInManifest, module.Assembly.FullName, $"0x{handle.GetToken():x8}"));
114
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_TypeRefBadScopeType, module.Assembly.FullName, $"0x{handle.GetToken():x8}"));
System\Reflection\TypeLoading\Modules\Ecma\EcmaModule.ManifestResources.cs (1)
57
throw new
BadImageFormatException
(SR.Format(SR.ManifestResourceInfoReferencedBadModule, result.FileName));
System\Reflection\TypeLoading\Modules\Ecma\EcmaModule.TypeProvider.cs (2)
35
public RoType GetGenericTypeParameter(TypeContext genericContext, int index) => genericContext.GetGenericTypeArgumentOrNull(index) ?? throw new
BadImageFormatException
(SR.Format(SR.GenericTypeParamIndexOutOfRange, index));
36
public RoType GetGenericMethodParameter(TypeContext genericContext, int index) => genericContext.GetGenericMethodArgumentOrNull(index) ?? throw new
BadImageFormatException
(SR.Format(SR.GenericMethodParamIndexOutOfRange, index));
System.Resources.Extensions (27)
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (21)
188
throw new
BadImageFormatException
(SR.BadImageFormat_NegativeStringLength);
343
throw new
BadImageFormatException
(SR.BadImageFormat_NegativeStringLength);
352
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesNameTooLong);
368
throw new
BadImageFormatException
(SR.BadImageFormat_ResourceNameCorrupted);
391
throw new
BadImageFormatException
(SR.BadImageFormat_NegativeStringLength);
397
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourcesIndexTooLong, index));
708
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
715
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
722
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
736
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
748
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
762
throw new
BadImageFormatException
(SR.BadImageFormat_TypeMismatch);
817
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
852
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
860
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
902
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
923
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
934
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
950
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
959
throw new
BadImageFormatException
(SR.BadImageFormat_ResourcesHeaderCorrupted);
975
throw new
BadImageFormatException
(SR.BadImageFormat_InvalidType);
System\Resources\Extensions\DeserializingResourceReader.cs (6)
136
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, length));
155
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, length));
165
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, length));
200
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, length));
225
throw new
BadImageFormatException
(SR.BadImageFormat_TypeMismatch);
231
throw new
BadImageFormatException
(SR.Format(SR.BadImageFormat_ResType_SerBlobMismatch, type.FullName, value.GetType().FullName));