[Mono-list] hello.exe compiled using mcs on linux, fails to run on Windows

Paolo Molaro lupus@ximian.com
Sat, 13 Apr 2002 15:27:28 +0200


On 04/12/02 Serge wrote:
> > p.net can read our files just fine, so I guess this is an issue that is
> > (at least) poorly specified in the spec.
> 
> HelloWorld exe generated with mcs/mono has size of #GUID stream set to 0.
> When "removing" the stream by changing MetadataRoot::Streams from 5 to 4 in
> the binary, PEVerify goes further and reports sctructural error in metadata,
> if set to ignore this error the next error it reports is about corrupted
> native header.

Yes, you can't just change the number of streams, because the rest of
the metadata would be offset by the size of the missing stream header...

> According to specs "Streams need not be there if they are empty", but it's
> not clear that 0-size streams are illegal.

Thanks for your feedback! Indeed, empty streams should be allowed,
though it turns out the the guid stream must have at least an entry for
the Module Mvid (this is spelled out in the new spec, but not in the old
one that I used at the time I wrote that code: I guess I should go and
review all the reflection stuff with the new spec).

Now ildasm can diassemble our binaries, but PEVerify still gives
the following errors:

[IL]: Error: Unverifiable PE Header/native stub.
[IL]: Error: Module load failed.

This may be because we don't include the x86 stub to load mscoree...

When used with the /MD option it completes successfully:

All Classes and Methods in console.exe Verified

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better