Mark Assousa
2008-06-20 19:44:24 UTC
I am receiving the following exception in a .Net 2.0 application:
{System.Runtime.Serialization.SerializationException}
System.Runtime.Serialization.SerializationException: {"Unable to
load type iFormsType.CommandPkg required for deserialization."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: Nothing
InnerException: Nothing
Message: "Unable to load type iFormsType.CommandPkg required for
deserialization."
Source: "mscorlib"
StackTrace: "
Server stack trace:
at
System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder
holder, Boolean bObjectFullyComplete)
at
System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups(ObjectHolder
holder)
at System.Runtime.Serialization.ObjectManager.RegisterObject(Object
obj, Int64 objectID, SerializationInfo info, Int64 idOfContainingObj,
MemberInfo member, Int32[] arrayIndex)
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject(Object
obj, ParseRecord pr, ParseRecord objectPr, Boolean bIsString)
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObjectEnd(ParseRecord
pr)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String
objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel
securityLevel)
at
System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack
sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream
requestStream, IMessage& responseMsg, ITransportHeaders&
responseHeaders, Stream& responseStream)
Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at iFormsType.IDbUtility.CmdExecTable(CommandPkg Command,
ConnectionEnum Connect)
at iForms.frmSection.LoadDataSection(Int32 ItemID, ClsSection
Section, Hashtable htblAnalysis, DataTable AnswersWithNotes) in
C:\Users\Mark Assousa\Documents\Visual Studio
2005\Projects\iForms\Form_Section.vb:line 1673"
TargetSite: {System.Reflection.RuntimeMethodInfo}
My application consists of three assemblies: iForms, iFormsServer, and
iFormsType. iFormsType contains the type definition of a structure,
CommandPkg, defined below. iForms calls APIs in iFormsServer, passing
CommandPkg as an argument. This is where I get the serialization
exception. Both iForms and iFormsServer reference iFormsType.
<Serializable()> Public Structure ParameterPkg
Public Direction As ParameterDirection
Public OleDbType As OleDbType
Public ParameterName As String
Public Size As Integer
Public SourceColumn As String
Public SourceVersion As DataRowVersion
Public Value As Object
End Structure
<Serializable()> Public Structure CommandPkg
Public CommandText As String
Public CommandType As CommandType
Public Parameters() As ParameterPkg
End Structure
I started with CommandPkg and ParameterPkg defined as classes with
appropriate constructors, same error. A added the
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
attribute to "Parameters", same error. I added Assembly:
TypeForwardedTo(GetType(CommandPkg)) in iFormsServer, ditto. I tried
removing "Parameters" to see if it was kind of collection related issue,
nada. I wrote a custom serializer/deserializer, zip. I converted the
classes to simple structures (above), problem continues. I removed and
re-added the iFormsType references and did a complete rebuild, same result.
I'm scraping the barrel for ideas here. My last are to consolidate
iFormsServer and iFormsType (fewer app domains can't hurt right?) or go
to XML serialization. Both of these are major surgery I'd prefer to
avoid and I don't know they'll even work.
Thoughts anyone?
{System.Runtime.Serialization.SerializationException}
System.Runtime.Serialization.SerializationException: {"Unable to
load type iFormsType.CommandPkg required for deserialization."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: Nothing
InnerException: Nothing
Message: "Unable to load type iFormsType.CommandPkg required for
deserialization."
Source: "mscorlib"
StackTrace: "
Server stack trace:
at
System.Runtime.Serialization.ObjectManager.CompleteObject(ObjectHolder
holder, Boolean bObjectFullyComplete)
at
System.Runtime.Serialization.ObjectManager.DoNewlyRegisteredObjectFixups(ObjectHolder
holder)
at System.Runtime.Serialization.ObjectManager.RegisterObject(Object
obj, Int64 objectID, SerializationInfo info, Int64 idOfContainingObj,
MemberInfo member, Int32[] arrayIndex)
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.RegisterObject(Object
obj, ParseRecord pr, ParseRecord objectPr, Boolean bIsString)
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObjectEnd(ParseRecord
pr)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String
objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel
securityLevel)
at
System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack
sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream
requestStream, IMessage& responseMsg, ITransportHeaders&
responseHeaders, Stream& responseStream)
Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at iFormsType.IDbUtility.CmdExecTable(CommandPkg Command,
ConnectionEnum Connect)
at iForms.frmSection.LoadDataSection(Int32 ItemID, ClsSection
Section, Hashtable htblAnalysis, DataTable AnswersWithNotes) in
C:\Users\Mark Assousa\Documents\Visual Studio
2005\Projects\iForms\Form_Section.vb:line 1673"
TargetSite: {System.Reflection.RuntimeMethodInfo}
My application consists of three assemblies: iForms, iFormsServer, and
iFormsType. iFormsType contains the type definition of a structure,
CommandPkg, defined below. iForms calls APIs in iFormsServer, passing
CommandPkg as an argument. This is where I get the serialization
exception. Both iForms and iFormsServer reference iFormsType.
<Serializable()> Public Structure ParameterPkg
Public Direction As ParameterDirection
Public OleDbType As OleDbType
Public ParameterName As String
Public Size As Integer
Public SourceColumn As String
Public SourceVersion As DataRowVersion
Public Value As Object
End Structure
<Serializable()> Public Structure CommandPkg
Public CommandText As String
Public CommandType As CommandType
Public Parameters() As ParameterPkg
End Structure
I started with CommandPkg and ParameterPkg defined as classes with
appropriate constructors, same error. A added the
DesignerSerializationVisibility(DesignerSerializationVisibility.Content)
attribute to "Parameters", same error. I added Assembly:
TypeForwardedTo(GetType(CommandPkg)) in iFormsServer, ditto. I tried
removing "Parameters" to see if it was kind of collection related issue,
nada. I wrote a custom serializer/deserializer, zip. I converted the
classes to simple structures (above), problem continues. I removed and
re-added the iFormsType references and did a complete rebuild, same result.
I'm scraping the barrel for ideas here. My last are to consolidate
iFormsServer and iFormsType (fewer app domains can't hurt right?) or go
to XML serialization. Both of these are major surgery I'd prefer to
avoid and I don't know they'll even work.
Thoughts anyone?