XmlSerializer fail loading myproj.XmlSerializers.dll
-
Hi all... and Happy new year! I already posted but got and found no solutions, I'll try to explain in a easier way: When I launch my XmlWriter.Serialize(MyType), it doesn't work. Usually when .NET uses the dll MyType.XmlSerializers.dll, which is compiled together with MyType.dll. At run time, if .NET does not find MyType.XmlSerializers.dll it creates at execution time. Now my problem is that it seams like .NET is using a completely different xmlserializer. And it always throws a System.InvalidOperationException, There was an error generating the XML document. String cannot have zero length at System.Reflection.Assembly.nLoad() Does somebody have a tip? P.S.: My app is an addon, so probably .NET is invoking an xmlserializer of the main app. When I run the addon by itself everything works.
Life is not short... the problem is only how you organize yourself
-
Hi all... and Happy new year! I already posted but got and found no solutions, I'll try to explain in a easier way: When I launch my XmlWriter.Serialize(MyType), it doesn't work. Usually when .NET uses the dll MyType.XmlSerializers.dll, which is compiled together with MyType.dll. At run time, if .NET does not find MyType.XmlSerializers.dll it creates at execution time. Now my problem is that it seams like .NET is using a completely different xmlserializer. And it always throws a System.InvalidOperationException, There was an error generating the XML document. String cannot have zero length at System.Reflection.Assembly.nLoad() Does somebody have a tip? P.S.: My app is an addon, so probably .NET is invoking an xmlserializer of the main app. When I run the addon by itself everything works.
Life is not short... the problem is only how you organize yourself
I found the solution on my own: In the addon binding I have to add the following event:
AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(currentDomain_AssemblyResolve);
In that event I can specify the path of the dll I wish to use.Life is not short... the problem is only how you organize yourself