175 references to BadImageFormatException
ILCompiler.ReadyToRun (2)
Compiler\DependencyAnalysis\ReadyToRun\DebugInfoTableNode.cs (1)
310throw new BadImageFormatException("Unexpected var loc type");
src\runtime\src\coreclr\tools\aot\ILCompiler.Reflection.ReadyToRun\PEReaderExtensions.cs (1)
144throw new BadImageFormatException("Failed to convert invalid RVA to offset: " + rva);
ILCompiler.TypeSystem (1)
src\runtime\src\coreclr\tools\Common\TypeSystem\Ecma\EcmaSignatureParser.cs (1)
85throw new BadImageFormatException("Type expected");
Microsoft.Build.Tasks.Core (2)
AssemblyDependency\AssemblyInformation.cs (1)
534throw new BadImageFormatException(string.Format(CultureInfo.CurrentCulture,
AssemblyDependency\ReferenceTable.cs (1)
2885throw new BadImageFormatException(ResourceUtilities.GetResourceString("ResolveAssemblyReference.ImplementationDllHasInvalidPEHeader"));
Microsoft.CodeAnalysis (7)
MetadataReader\MetadataReaderExtensions.cs (5)
106throw new BadImageFormatException(string.Format(CodeAnalysisResources.InvalidAssemblyName, nameStr)); 112throw new BadImageFormatException(string.Format(CodeAnalysisResources.InvalidCultureName, cultureName)); 125throw new BadImageFormatException(CodeAnalysisResources.InvalidPublicKey); 133throw new BadImageFormatException(CodeAnalysisResources.InvalidPublicKeyToken); 146throw new BadImageFormatException(CodeAnalysisResources.InvalidPublicKey);
MetadataReader\PEModule.cs (2)
263throw new BadImageFormatException(CodeAnalysisResources.PEImageDoesntContainManagedMetadata); 396throw new BadImageFormatException(string.Format(CodeAnalysisResources.InvalidModuleName, this.Name, moduleName));
Microsoft.Diagnostics.DataContractReader.Contracts (23)
Contracts\GCInfo\X86\GCArgTable.cs (3)
190throw new BadImageFormatException($"Unexpected special code {val}"); 241_ => throw new BadImageFormatException("Invalid this-pointer register encoding"), 507throw new BadImageFormatException("Invalid GC encoding");
Contracts\GCInfo\X86\InfoHdr.cs (3)
290throw new BadImageFormatException("Unexpected gcinfo header encoding"); 294throw new BadImageFormatException("Unexpected gcinfo header encoding"); 328throw new BadImageFormatException("Unexpected gcinfo header encoding");
Contracts\Signature\RuntimeSignatureDecoder.cs (6)
125throw new BadImageFormatException($"Unexpected signature type code: 0x{typeCode:X2}"); 137throw new BadImageFormatException("Signature type sequence must have at least one element"); 296throw new BadImageFormatException("TypeSpecification handle not allowed in this context"); 302throw new BadImageFormatException("Expected TypeDef, TypeRef, or TypeSpec handle"); 314throw new BadImageFormatException($"Expected signature header {expectedKind}, got {header.Kind} (raw 0x{header.RawValue:X2})"); 323throw new BadImageFormatException($"Expected Method or Property signature header, got {kind} (raw 0x{header.RawValue:X2})");
src\runtime\src\coreclr\tools\aot\ILCompiler.Reflection.ReadyToRun\NativeReader.cs (11)
199throw new System.BadImageFormatException("offset out of bounds"); 212throw new System.BadImageFormatException("offset out of bounds"); 221throw new System.BadImageFormatException("offset out of bounds"); 231throw new System.BadImageFormatException("offset out of bounds"); 246throw new System.BadImageFormatException("DecodeUnsigned"); 258throw new System.BadImageFormatException("offset out of bounds"); 271throw new System.BadImageFormatException("offset out of bounds"); 280throw new System.BadImageFormatException("offset out of bounds"); 290throw new System.BadImageFormatException("offset out of bounds"); 305throw new System.BadImageFormatException("DecodeSigned"); 396throw new BadImageFormatException("Unexpected end of image while reading ULEB128");
Microsoft.Diagnostics.DataContractReader.Legacy (2)
HeaderReaderHelpers.cs (2)
33throw new BadImageFormatException("Invalid IL method header."); 44throw new BadImageFormatException("Invalid IL method header.");
Microsoft.NET.HostModel (1)
ComHost\ClsidMap.cs (1)
296throw new BadImageFormatException("Unexpectedly got an enum parameter for an attribute.");
Mono.Cecil (1)
Mono.Cecil\WindowsRuntimeProjections.cs (1)
851 throw new BadImageFormatException ("Missing mscorlib reference in AssemblyRef table.");
System.Private.CoreLib (28)
Internal\Runtime\TypeLoaderExceptionHelper.cs (1)
24return new BadImageFormatException(GetFormatString(id));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\Assembly.cs (1)
262throw new BadImageFormatException(SR.BadImageFormat_EmptyAssembly);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.Core.cs (2)
73throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResType_SerBlobMismatch, type.FullName, graph.GetType().FullName)); 173throw new BadImageFormatException(SR.BadImageFormat_InvalidType);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (21)
184throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength); 339throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength); 348throw new BadImageFormatException(SR.BadImageFormat_ResourcesNameTooLong); 364throw new BadImageFormatException(SR.BadImageFormat_ResourceNameCorrupted); 387throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength); 393throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourcesIndexTooLong, index)); 704throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len)); 711throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len)); 718throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len)); 732throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len)); 744throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len)); 758throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch); 813throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 848throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 856throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 898throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 919throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 930throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 946throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 955throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 971throw new BadImageFormatException(SR.BadImageFormat_InvalidType);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Loader\AssemblyLoadContext.cs (2)
428throw new BadImageFormatException(SR.BadImageFormat_EmptyAssembly); 464throw new BadImageFormatException(SR.BadImageFormat_BadILFormat);
System\Reflection\Runtime\MethodInfos\RuntimeNamedMethodInfo.cs (1)
140throw new BadImageFormatException(SR.CannotUseByRefLikeTypeInInstantiation);
System.Reflection.Metadata (74)
System\Reflection\Metadata\BlobReader.cs (2)
349throw new BadImageFormatException(SR.ValueTooLarge); 697throw new BadImageFormatException(SR.InvalidConstantValue);
System\Reflection\Metadata\Ecma335\CustomAttributeDecoder.cs (1)
419_ => throw new BadImageFormatException(SR.NotTypeDefOrRefHandle),
System\Reflection\Metadata\Ecma335\MetadataAggregator.cs (1)
227throw new BadImageFormatException(SR.EnCMapNotSorted);
System\Reflection\Metadata\Ecma335\SignatureDecoder.cs (6)
130throw new BadImageFormatException(SR.Format(SR.UnexpectedSignatureTypeCode, typeCode)); 145throw new BadImageFormatException(SR.SignatureTypeSequenceMustHaveAtLeastOneElement); 316throw new BadImageFormatException(SR.NotTypeDefOrRefHandle); 328throw new BadImageFormatException(SR.NotTypeDefOrRefOrSpecHandle); 335throw new BadImageFormatException(SR.Format(SR.UnexpectedSignatureHeader, expectedKind, header.Kind, header.RawValue)); 344throw new BadImageFormatException(SR.Format(SR.UnexpectedSignatureHeader2, SignatureKind.Property, SignatureKind.Method, header.Kind, header.RawValue));
System\Reflection\Metadata\IL\MethodBodyBlock.cs (4)
121throw new BadImageFormatException(SR.Format(SR.InvalidMethodHeader1, headByte)); 128throw new BadImageFormatException(SR.Format(SR.InvalidMethodHeader2, headByte, headByte2)); 149throw new BadImageFormatException(SR.Format(SR.InvalidLocalSignatureToken, unchecked((uint)localSignatureToken))); 162throw new BadImageFormatException(SR.Format(SR.InvalidSehHeader, sehHeader));
System\Reflection\Metadata\Internal\BlobHeap.cs (1)
192throw new BadImageFormatException(SR.InvalidDocumentName);
System\Reflection\Metadata\MetadataReader.cs (23)
136throw new BadImageFormatException(SR.Format(SR.ModuleTableInvalidNumberOfRows, this.ModuleTable.NumberOfRows)); 182throw new BadImageFormatException(SR.MetadataHeaderTooSmall); 188throw new BadImageFormatException(SR.MetadataSignature); 203throw new BadImageFormatException(SR.NotEnoughSpaceForVersionString); 246throw new BadImageFormatException(SR.StreamHeaderTooSmall); 256throw new BadImageFormatException(SR.NotEnoughSpaceForStreamHeaderName); 281throw new BadImageFormatException(SR.NotEnoughSpaceForStringStream); 290throw new BadImageFormatException(SR.NotEnoughSpaceForBlobStream); 299throw new BadImageFormatException(SR.NotEnoughSpaceForGUIDStream); 308throw new BadImageFormatException(SR.NotEnoughSpaceForBlobStream); 317throw new BadImageFormatException(SR.NotEnoughSpaceForMetadataStream); 327throw new BadImageFormatException(SR.NotEnoughSpaceForMetadataStream); 337throw new BadImageFormatException(SR.NotEnoughSpaceForMetadataStream); 347throw new BadImageFormatException(SR.NotEnoughSpaceForMetadataStream); 361throw new BadImageFormatException(SR.InvalidMetadataStreamFormat); 436throw new BadImageFormatException(SR.MetadataTableHeaderTooSmall); 467throw new BadImageFormatException(SR.Format(SR.UnknownTables, presentTables)); 478throw new BadImageFormatException(SR.IllegalTablesInCompressedMetadataStream); 503throw new BadImageFormatException(SR.TableRowCountSpaceTooSmall); 509throw new BadImageFormatException(SR.Format(SR.InvalidRowCount, rowCount)); 539throw new BadImageFormatException(SR.Format(SR.InvalidEntryPointToken, entryPointToken)); 549throw new BadImageFormatException(SR.Format(SR.UnknownTables, externalTableMask)); 781throw new BadImageFormatException(SR.MetadataTablesTooSmall);
System\Reflection\Metadata\MetadataReader.WinMD.cs (1)
658throw new BadImageFormatException(SR.WinMDMissingMscorlibRef);
System\Reflection\Metadata\PEReaderExtensions.cs (1)
34throw new BadImageFormatException(SR.Format(SR.InvalidMethodRva, relativeVirtualAddress));
System\Reflection\Metadata\PortablePdb\ImportDefinitionCollection.cs (1)
123throw new BadImageFormatException(SR.Format(SR.InvalidImportDefinitionKind, kind));
System\Reflection\Metadata\TypeSystem\TypeDefinition.cs (1)
146throw new BadImageFormatException(SR.InvalidTypeSize);
System\Reflection\PortableExecutable\PEHeader.cs (1)
289throw new BadImageFormatException(SR.UnknownPEMagicValue);
System\Reflection\PortableExecutable\PEHeaders.cs (9)
96throw new BadImageFormatException(SR.InvalidPESignature); 107throw new BadImageFormatException(SR.UnknownFileFormat); 256throw new BadImageFormatException(SR.InvalidCorHeaderSize); 281throw new BadImageFormatException(SR.UnknownFileFormat); 301throw new BadImageFormatException(SR.InvalidPESignature); 311throw new BadImageFormatException(SR.InvalidNumberOfSections); 347throw new BadImageFormatException(SR.SectionTooSmall); 414throw new BadImageFormatException(SR.MissingDataDirectory); 425throw new BadImageFormatException(SR.InvalidMetadataSectionSpan);
System\Reflection\PortableExecutable\PEReader.cs (5)
548throw new BadImageFormatException(SR.InvalidDirectoryRVA); 553throw new BadImageFormatException(SR.InvalidDirectorySize); 572throw new BadImageFormatException(SR.InvalidDebugDirectoryEntryCharacteristics); 627throw new BadImageFormatException(SR.UnexpectedCodeViewDataSignature); 666throw new BadImageFormatException(SR.InvalidPdbChecksumDataFormat);
System\Reflection\PortableExecutable\PEReader.EmbeddedPortablePdb.cs (5)
58throw new BadImageFormatException(SR.Format(SR.UnsupportedFormatVersion, PortablePdbVersions.Format(formatVersion))); 64throw new BadImageFormatException(SR.Format(SR.UnsupportedFormatVersion, PortablePdbVersions.Format(embeddedBlobVersion))); 76throw new BadImageFormatException(SR.UnexpectedEmbeddedPortablePdbDataSignature); 111throw new BadImageFormatException(SR.SizeMismatch); 120throw new BadImageFormatException(SR.SizeMismatch);
System\Reflection\Throw.cs (12)
155throw new BadImageFormatException(SR.OutOfBoundsRead); 167throw new BadImageFormatException(SR.InvalidCodedIndex); 173throw new BadImageFormatException(SR.InvalidHandle); 179throw new BadImageFormatException(SR.InvalidCompressedInteger); 185throw new BadImageFormatException(SR.InvalidSerializedString); 191throw new BadImageFormatException(SR.ImageTooSmall); 197throw new BadImageFormatException(SR.ImageTooSmallOrContainsInvalidOffsetOrCount); 203throw new BadImageFormatException(SR.RowIdOrHeapOffsetTooLarge); 209throw new BadImageFormatException(SR.Format(SR.MetadataTableNotSorted, tableIndex)); 227throw new BadImageFormatException(SR.TooManySubnamespaces); 233throw new BadImageFormatException(SR.ValueTooLarge); 239throw new BadImageFormatException(SR.SequencePointValueOutOfRange);
System.Reflection.MetadataLoadContext (7)
System\Reflection\MetadataLoadContext.Loading.cs (1)
27throw new BadImageFormatException(SR.NoMetadataInPeImage);
System\Reflection\TypeLoading\General\Ecma\EcmaHelpers.cs (1)
77throw new BadImageFormatException(SR.Format(SR.UnexpectedUnderlyingEnumType, enumType, type));
System\Reflection\TypeLoading\General\Ecma\EcmaResolver.cs (2)
105throw new BadImageFormatException(SR.Format(SR.BadImageFormat_TypeRefModuleNotInManifest, module.Assembly.FullName, $"0x{handle.GetToken():x8}")); 114throw new BadImageFormatException(SR.Format(SR.BadImageFormat_TypeRefBadScopeType, module.Assembly.FullName, $"0x{handle.GetToken():x8}"));
System\Reflection\TypeLoading\Modules\Ecma\EcmaModule.ManifestResources.cs (1)
57throw new BadImageFormatException(SR.Format(SR.ManifestResourceInfoReferencedBadModule, result.FileName));
System\Reflection\TypeLoading\Modules\Ecma\EcmaModule.TypeProvider.cs (2)
35public RoType GetGenericTypeParameter(TypeContext genericContext, int index) => genericContext.GetGenericTypeArgumentOrNull(index) ?? throw new BadImageFormatException(SR.Format(SR.GenericTypeParamIndexOutOfRange, index)); 36public RoType GetGenericMethodParameter(TypeContext genericContext, int index) => genericContext.GetGenericMethodArgumentOrNull(index) ?? throw new BadImageFormatException(SR.Format(SR.GenericMethodParamIndexOutOfRange, index));
System.Resources.Extensions (27)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (21)
184throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength); 339throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength); 348throw new BadImageFormatException(SR.BadImageFormat_ResourcesNameTooLong); 364throw new BadImageFormatException(SR.BadImageFormat_ResourceNameCorrupted); 387throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength); 393throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourcesIndexTooLong, index)); 704throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len)); 711throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len)); 718throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len)); 732throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len)); 744throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len)); 758throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch); 813throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 848throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 856throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 898throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 919throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 930throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 946throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 955throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted); 971throw new BadImageFormatException(SR.BadImageFormat_InvalidType);
System\Resources\Extensions\DeserializingResourceReader.cs (6)
136throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, length)); 155throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, length)); 165throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, length)); 200throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, length)); 225throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch); 231throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResType_SerBlobMismatch, type.FullName, value.GetType().FullName));