bool ReadMetadataHeader(
   ref MemoryReader memReader
 )
   //^ requires this.ReaderState >= ReaderState.PEFile;
 {
   if (memReader.RemainingBytes < COR20Constants.MinimumSizeofMetadataHeader) {
     this.ErrorContainer.AddDirectoryError(Directories.Cor20HeaderMetaData, 0, MetadataReaderErrorKind.MetadataHeaderTooSmall);
     return false;
   }
   this.MetadataHeader.Signature = memReader.ReadUInt32();
   if (this.MetadataHeader.Signature != COR20Constants.COR20MetadataSignature) {
     this.ErrorContainer.AddDirectoryError(Directories.Cor20HeaderMetaData, memReader.Offset - sizeof(uint), MetadataReaderErrorKind.MetadataSignature);
     return false;
   }
   this.MetadataHeader.MajorVersion = memReader.ReadUInt16();
   this.MetadataHeader.MinorVersion = memReader.ReadUInt16();
   this.MetadataHeader.ExtraData = memReader.ReadUInt32();
   this.MetadataHeader.VersionStringSize = memReader.ReadInt32();
   if (memReader.RemainingBytes < this.MetadataHeader.VersionStringSize) {
     this.ErrorContainer.AddDirectoryError(Directories.Cor20HeaderMetaData, memReader.Offset, MetadataReaderErrorKind.NotEnoughSpaceForVersionString);
     return false;
   }
   int numberOfBytesRead;
   this.MetadataHeader.VersionString = memReader.PeekUTF8NullTerminated(0, out numberOfBytesRead);
   memReader.SkipBytes(this.MetadataHeader.VersionStringSize);
   return true;
 }