This code cause BadImageFormatException. An error message is:
"A BadImageFormatException has been thrown while parsing the signature.
This is likely due to lack of a generic context. Ensure
genericTypeArguments and genericMethodArguments are provided and
contain enough context."
InnerException:
"An attempt was made to load a program with an incorrect format.
(Exception from HRESULT: 0x8007000B)"
My target is to load an assembly and serialize it for future proposes.
So I can not use LoadFrom() directly.
Do anybody have any suggestions?
Thanks for all
There's no guarantee that a single call to Read will fill the byte
array. You should check the return value and if necessary keep calling
Read until everything has been read or the end of the stream is
reached.
>My target is to load an assembly and serialize it for future proposes.
>So I can not use LoadFrom() directly.
But does it load correctly if you use Assembly.LoadFrom(fileName) so
you know that the file isn't corrupt or anything?
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Read what Gregory Beamer said in another post in this group. It makes no
sense to 'serialize an assembly'. What are you trying to gain from
serializing an assembly as opposed to loading the assembly from disk?
Richard
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial:
http://www.grimes.demon.co.uk/workshops/securityWS.htm