Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 207710

XmlSerializers doesn't seem to be loading

$
0
0

I'm in a .net  project and have gone through the steps to generate the VimService dll and XmlSerializers but I still get errors like System.InvalidCastException: Unable to cast object of type 'System.Xml.XmlNode[]' to type 'VMWare.vSphere.CustomFieldDef[]' when trying to run api operations.

 

I'm using VS 2010 to compile the initial service with all the serializers uncommented in .net 3.5 framework (stupid requirement of product I'm using these dlls with), generating the XmlSerializers with sgen /p, removing all the references to [System.Xml.Serialization.XmlIncludeAttribute, adding System.Xml.Serialization.XmlSerializerAssemblyAttribute(AssemblyName = "VMWare.vSphere.XmlSerializers")] above the VimService class declaration and recompiling.  I add both dlls as References in my projects and even call Assembly.Load("VMWare.vSphere.XmlSerializers"); in my unit tests to ensure it really can find the dll.

 

Even after all that, I still get the casting issues.   If I add back the specific XmlIncludeAttributes, they cast fine.  I have also done this using all .net 4.0 tools compiling for .net 4.0 and I still get the same issue.  Is there any way to test the XmlSerializerAssemblyAttribute to see if it worked or see what attributes have been precompiled in that dll?

 

Thanks,
Dan


Viewing all articles
Browse latest Browse all 207710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>