Home All Groups Group Topic Archive Search About

XmlSerializer for a type in dynamically loaded assembly

Author
3 Aug 2006 7:15 PM
kris1090
Hi
I have an assembly which I load using Assembly.Load(bytes[]). Within
the Assembly i have a method which invokes XmlSerializer.serialize
method on a type. This type is also within the assembly.

However the serialize method throws an exception saying

Unable to generate a serializer for type MyNamespace.Classtype from
assembly <Unknown> because the assembly may be dynamic. Save the
assembly and load it from disk to use it with XmlSerialization

On a different machine the constructor for the serializer failed to
generate with following error:

Unable to generate a temporary class (result=1).
error CS0234: The type or namespace name 'xxxxx' does not exist in the
class or namespace yyyy

Everything works fine if i load the assembly using LoadFrom. Is this a
security problem?

How do i solve it?

Thanks in advance.

AddThis Social Bookmark Button