Discussion:
SerializationException
(too old to reply)
Mark Assousa
2008-06-20 19:44:24 UTC
Permalink
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?
Tommaso Caldarola
2008-06-23 07:00:04 UTC
Permalink
Post by Mark Assousa
{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: "
[snip]...
Post by Mark Assousa
Thoughts anyone?
iFormsType.CommandPkg is on both client and server?
Newsgroup
2008-09-21 04:06:03 UTC
Permalink
check whether "iFormsType.CommandPkg " class is refered in both remoting
client and server.

Common Practise:

RemotingDll

RemoteServer - ref RemotingDll
RemoteClient - ref RemotingDll

- Jibesh
Post by Tommaso Caldarola
Post by Mark Assousa
{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: "
[snip]...
Post by Mark Assousa
Thoughts anyone?
iFormsType.CommandPkg is on both client and server?
unknown
2008-08-14 12:21:21 UTC
Permalink
Type 'Lspl.Db.CommonSql' in Assembly 'util, Version=1.0.3133.20776, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

util is one of the dll file.
Phill W.
2008-08-14 12:39:37 UTC
Permalink
Post by unknown
Type 'Lspl.Db.CommonSql' in Assembly 'util, Version=1.0.3133.20776, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
util is one of the dll file.
Good for you!

And your /question/ is?



I've seen this most often in .Net Remoting, which has to serialise your
objects in order to get the across the Great .Net Remoting Divide, i.e.
from client to server.

By default, classes are not serializable; you have to mark them as such,
with the Serializable Attribute (and, IMHO, write the custom
serialisation code as well).

Regards,
Phill W.
Loading...