Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Fri, 20 Jun 2008 14:44:24 -0500,    group: microsoft.public.dotnet.framework.remoting        back       


SerializationException   
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?
date: Fri, 20 Jun 2008 14:44:24 -0500   author:   Mark Assousa

Re: SerializationException   
Mark Assousa wrote:
> 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:

[snip]...

> 
> Thoughts anyone?

iFormsType.CommandPkg is on both client and server?
date: Mon, 23 Jun 2008 09:00:04 +0200   author:   Tommaso Caldarola

Serialization Exception unabled   
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.
date: Thu, 14 Aug 2008 05:21:21 -0700   author:   dhina karan

Re: Serialization Exception unabled   
dhina karan wrote:
> 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.
date: Thu, 14 Aug 2008 13:39:37 +0100   author:   Phill W. p-.-a-.-w-a-r-d-@-o-p-e-n-.-a-c-.-u-k

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us