var txnSerializer = new TxnSerializer(); //generated serializer
TextWriter writer = new StringWriter();
txnSerializer.Serialize(writer, response.ReturnValue);
is throwing the following exception:
System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=There was an error generating the XML document.
Source=System.Xml
StackTrace:
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces)
at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
at Tests.MiscTests.MyTest() in c:\dev\MiscTests.cs:line 377
InnerException: System.MissingMethodException
HResult=-2146233069
Message=Method not found: 'Project.ClosingInstructionsType Project.Txn.get_ClosingInstructions()'.
Source=Project.Schema.XmlSerializers
StackTrace:
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1761_Txn(String n, String ns, Txn o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write3518_Txn(Object o)
at Microsoft.Xml.Serialization.GeneratedAssembly.TxnSerializer.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
InnerException:
Here's the weird part: it works fine on all the other development workstations on the team except mine. This is one of many failing tests, all failing with the same error. Help!
The
System.MissingMethodException
is almost always a symptom of an incorrect .NET application environment (eg, DLL version mismatches). I would try the following actions:gacutil /u DLL_NAME
. Restart IIS after this. Reinstall the correct assemblies needed in the GAC withgacutil /if "<path to the assembly .dll file>"