Deserialization Problem.

P

Peter Tewkesbury

Hi,

I want to serialize an object graph. The objects in the
object graph are either defined in the main assembly, or
in seperate assemblies which are loaded using
Assembly.LoadFile(<fileName>). I then use CreateInstance()
to create the object, and add it to the object graph.

Serialization works correctly, and all objects get
serialized to the file. However, when I deserialize the
objects, I keep getting an Soap Serialization exception

#An unhandled exception of
#type 'System.Runtime.Serialization.SerializationException'
# occurred in
#system.runtime.serialization.formatters.soap.dll
#
#Additional information: Parse Error, no assembly
#associated with Xml key
#a4:http://schemas.microsoft.com/clr/nsassem/ISDev/ISDev%
#2C%20Version%3D1.0.1348.21553%2C%20Culture%3Dneutral%2C%
#20PublicKeyToken%3Dnull VSBCustom

However, I have loaded the assembly which contains the
VSBCustom Class, and I can create objects of that type.

Does any one have any ideas?

Thanks in advance.

Peter Tewkesbury
 
Y

Yan-Hong Huang[MSFT]

Hello Peter,

Thanks for posting in the group.

The error message means that it can't find the assembly of the type
represented by the following string:
Parse Error, no assembly associated with Xml key
a4:http://schemas.microsoft.com/clr/nsassem/ISDev/ISDev, Version=1.0.1
348.21553%2C%20Culture%Dneutral%2C%20PublicKeyToken%3Dnull VSBCustom

Please check more on ISDev version 3.0.0.128. If the version of this
assembly has changed, this problem may occur and may need a re-compile. I
suggest you extract this assembly out and test it to see if it could be
serialized correctly.

Please post here if the problem is not resolved.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Peter Tewkesbury" <[email protected]>
!Sender: "Peter Tewkesbury" <[email protected]>
!Subject: Deserialization Problem.
!Date: Wed, 10 Sep 2003 05:00:53 -0700
!Lines: 31
!Message-ID: <[email protected]>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcN3ky+iosTp19BjR0inZjimCq37dw==
!Newsgroups: microsoft.public.dotnet.framework
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:53352
!NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
!X-Tomcat-NG: microsoft.public.dotnet.framework
!
!Hi,
!
!I want to serialize an object graph. The objects in the
!object graph are either defined in the main assembly, or
!in seperate assemblies which are loaded using
!Assembly.LoadFile(<fileName>). I then use CreateInstance()
!to create the object, and add it to the object graph.
!
!Serialization works correctly, and all objects get
!serialized to the file. However, when I deserialize the
!objects, I keep getting an Soap Serialization exception
!
!#An unhandled exception of
!#type 'System.Runtime.Serialization.SerializationException'
!# occurred in
!#system.runtime.serialization.formatters.soap.dll
!#
!#Additional information: Parse Error, no assembly
!#associated with Xml key
!#a4:http://schemas.microsoft.com/clr/nsassem/ISDev/ISDev%
!#2C%20Version%3D1.0.1348.21553%2C%20Culture%3Dneutral%2C%
!#20PublicKeyToken%3Dnull VSBCustom
!
!However, I have loaded the assembly which contains the
!VSBCustom Class, and I can create objects of that type.
!
!Does any one have any ideas?
!
!Thanks in advance.
!
!Peter Tewkesbury
!
 
P

Peter Tewkesbury

Hi

I have found the problem. The assembly for the ISDev
object where in a different directory to the main
executable. Is there any way of defining a directory path
to search for assemblies in this case?

Peter
-----Original Message-----
Hello Peter,

Thanks for posting in the group.

The error message means that it can't find the assembly of the type
represented by the following string:
Parse Error, no assembly associated with Xml key
a4:http://schemas.microsoft.com/clr/nsassem/ISDev/ISDev% 2C%20Version%3D1.0.1
348.21553%2C%20Culture%Dneutral%2C%20PublicKeyToken% 3Dnull VSBCustom

Please check more on ISDev version 3.0.0.128. If the version of this
assembly has changed, this problem may occur and may need a re-compile. I
suggest you extract this assembly out and test it to see if it could be
serialized correctly.

Please post here if the problem is not resolved.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Peter Tewkesbury" <[email protected]>
!Sender: "Peter Tewkesbury" <[email protected]>
!Subject: Deserialization Problem.
!Date: Wed, 10 Sep 2003 05:00:53 -0700
!Lines: 31
!Message-ID: <[email protected]>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcN3ky+iosTp19BjR0inZjimCq37dw==
!Newsgroups: microsoft.public.dotnet.framework
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:53352
!NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
!X-Tomcat-NG: microsoft.public.dotnet.framework
!
!Hi,
!
!I want to serialize an object graph. The objects in the
!object graph are either defined in the main assembly, or
!in seperate assemblies which are loaded using
!Assembly.LoadFile(<fileName>). I then use CreateInstance ()
!to create the object, and add it to the object graph.
!
!Serialization works correctly, and all objects get
!serialized to the file. However, when I deserialize the
!objects, I keep getting an Soap Serialization exception
!
!#An unhandled exception of
!
#type 'System.Runtime.Serialization.SerializationException'
 
D

Dave

Your problem is related to the difference between using and using LoadFrom.
These links discuss this issue.

http://www.gotdotnet.com/team/clr/LoadFromIsolation.aspx
http://blogs.gotdotnet.com/suzcook/PermaLink.aspx/d5c5e14a-3612-4af1-a9b7-0a144c8dbf16

If the assembly is in the same directory as your application it should be
able to automatically find it (obviously it currently is not). If the
assembly is located in a subdirectory below the application base directory
you can add the relative path to the appdomain's private bin path and the
runtime will then automatically locate it for you. You can also try adding a
handler to the AssemblyResolve event and using LoadFrom to force the runtime
to use the assembly.
 
Y

Yan-Hong Huang[MSFT]

Hello Peter,

I am glad to hear that we have found the problem. :)

For the question, Dave has provided good information on it.

When .NET runtime probes for the assembly, it uses the following steps:
1) If configuration and publisher policy do not affect the original
reference and if the bind request was created using the Assembly.LoadFrom
method, the runtime checks for location hints.
2) If a codebase is found in the configuration files, the runtime checks
only this location. If this probe fails, the runtime determines that the
binding request failed and no other probing occurs.
3) Probes for the assembly using the heuristics described in the probing
section. If the assembly is not found after probing, the runtime requests
the Windows Installer to provide the assembly. This acts as an
install-on-demand feature.

There is a good MSDN link on how the runtime locates assemblies in .NET
programming. Please refer to
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconhowruntimelocatesassemblies.asp for details.

Does that answer your question?

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: "Peter Tewkesbury" <[email protected]>
!Sender: "Peter Tewkesbury" <[email protected]>
!References: <[email protected]>
<[email protected]>
!Subject: RE: Deserialization Problem.
!Date: Thu, 11 Sep 2003 02:57:28 -0700
!Lines: 100
!Message-ID: <[email protected]>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcN4SxwVRKWBeh4rQnOU0FjRrOy8oQ==
!Newsgroups: microsoft.public.dotnet.framework
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework:53462
!NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
!X-Tomcat-NG: microsoft.public.dotnet.framework
!
!Hi
!
!I have found the problem. The assembly for the ISDev
!object where in a different directory to the main
!executable. Is there any way of defining a directory path
!to search for assemblies in this case?
!
!Peter
!
!>-----Original Message-----
!>Hello Peter,
!>
!>Thanks for posting in the group.
!>
!>The error message means that it can't find the assembly
!of the type
!>represented by the following string:
!> Parse Error, no assembly associated with Xml key
!>a4:http://schemas.microsoft.com/clr/nsassem/ISDev/ISDev%
!2C%20Version%3D1.0.1
!>348.21553%2C%20Culture%Dneutral%2C%20PublicKeyToken%
!3Dnull VSBCustom
!>
!>Please check more on ISDev version 3.0.0.128. If the
!version of this
!>assembly has changed, this problem may occur and may need
!a re-compile. I
!>suggest you extract this assembly out and test it to see
!if it could be
!>serialized correctly.
!>
!>Please post here if the problem is not resolved.
!>
!>Best regards,
!>Yanhong Huang
!>Microsoft Online Partner Support
!>
!>Get Secure! - www.microsoft.com/security
!>This posting is provided "AS IS" with no warranties, and
!confers no rights.
!>
!>--------------------
!>!Content-Class: urn:content-classes:message
!>!From: "Peter Tewkesbury" <[email protected]>
!>!Sender: "Peter Tewkesbury" <[email protected]>
!>!Subject: Deserialization Problem.
!>!Date: Wed, 10 Sep 2003 05:00:53 -0700
!>!Lines: 31
!>!Message-ID: <[email protected]>
!>!MIME-Version: 1.0
!>!Content-Type: text/plain;
!>! charset="iso-8859-1"
!>!Content-Transfer-Encoding: 7bit
!>!X-Newsreader: Microsoft CDO for Windows 2000
!>!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!>!Thread-Index: AcN3ky+iosTp19BjR0inZjimCq37dw==
!>!Newsgroups: microsoft.public.dotnet.framework
!>!Path: cpmsftngxa06.phx.gbl
!>!Xref: cpmsftngxa06.phx.gbl
!microsoft.public.dotnet.framework:53352
!>!NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
!>!X-Tomcat-NG: microsoft.public.dotnet.framework
!>!
!>!Hi,
!>!
!>!I want to serialize an object graph. The objects in the
!>!object graph are either defined in the main assembly, or
!>!in seperate assemblies which are loaded using
!>!Assembly.LoadFile(<fileName>). I then use CreateInstance
!()
!>!to create the object, and add it to the object graph.
!>!
!>!Serialization works correctly, and all objects get
!>!serialized to the file. However, when I deserialize the
!>!objects, I keep getting an Soap Serialization exception
!>!
!>!#An unhandled exception of
!>!
!#type 'System.Runtime.Serialization.SerializationException'
!>!# occurred in
!>!#system.runtime.serialization.formatters.soap.dll
!>!#
!>!#Additional information: Parse Error, no assembly
!>!#associated with Xml key
!>!#a4:http://schemas.microsoft.com/clr/nsassem/ISDev/ISDev%
!>!#2C%20Version%3D1.0.1348.21553%2C%20Culture%3Dneutral%2C%
!>!#20PublicKeyToken%3Dnull VSBCustom
!>!
!>!However, I have loaded the assembly which contains the
!>!VSBCustom Class, and I can create objects of that type.
!>!
!>!Does any one have any ideas?
!>!
!>!Thanks in advance.
!>!
!>!Peter Tewkesbury
!>!
!>
!>.
!>
!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top