SoapFormatter Deserialize - Parse Error, no assembly associated withXml key

U

Udi

Hi,
I'm having problems deserializing my class using SoapFormatter.
I have a process that dynamically loads an assembly ‘A’.
Assembly ‘A’ in turn implicitly loads assembly ‘B’ that contains the
serialzed class and the deserialization code (see below).

However, in case assembly ‘B’ is located in a folder different than
the process’s current working directory
I get the following exception:
“Parse Error, no assembly associated with Xml key a1:http://
schemas.microsoft.com/clr/nsassem/….”

When moving assembly ‘B’ to the process current directory, everything
works fine.

Does anyone know what is the cause of this problem and how can I get
over it?
Thanks,
Udi

[Serializable]
public class ChipLabProps
{
:
:
}

public ChipLabProps LoadProps()
{
using (FileStream fileStream = new FileStream(propFileName,
FileMode.OpenOrCreate, FileAccess.Read))
{
IFormatter formatter = new SoapFormatter();

return (ChipLabProps)formatter.Deserialize(fileStream);
}
}
 
N

not_a_commie

The AppDomain class has some methods for adding private search paths.
Use that to include your other folder. You could also preload the
assembly directly using AppDomain.Load or Assembly.Load.
 
P

Paul

I think you need to give us a full code example. Are you using Assembly.Load
or instantiating an object using SOAP.

I presume these are model objects so my next question is why seperate out
model objects.....




Hi,
I'm having problems deserializing my class using SoapFormatter.
I have a process that dynamically loads an assembly ‘A’.
Assembly ‘A’ in turn implicitly loads assembly ‘B’ that contains the
serialzed class and the deserialization code (see below).

However, in case assembly ‘B’ is located in a folder different than
the process’s current working directory
I get the following exception:
“Parse Error, no assembly associated with Xml key a1:http://
schemas.microsoft.com/clr/nsassem/….”

When moving assembly ‘B’ to the process current directory, everything
works fine.

Does anyone know what is the cause of this problem and how can I get
over it?
Thanks,
Udi

[Serializable]
public class ChipLabProps
{
:
:
}

public ChipLabProps LoadProps()
{
using (FileStream fileStream = new FileStream(propFileName,
FileMode.OpenOrCreate, FileAccess.Read))
{
IFormatter formatter = new SoapFormatter();

return (ChipLabProps)formatter.Deserialize(fileStream);
}
}
 
P

Paul

I think you need to give us a full code example. Are you using Assembly.Load
or instantiating an object using SOAP.

I presume these are model objects so my next question is why seperate out
model objects.....




Hi,
I'm having problems deserializing my class using SoapFormatter.
I have a process that dynamically loads an assembly ‘A’.
Assembly ‘A’ in turn implicitly loads assembly ‘B’ that contains the
serialzed class and the deserialization code (see below).

However, in case assembly ‘B’ is located in a folder different than
the process’s current working directory
I get the following exception:
“Parse Error, no assembly associated with Xml key a1:http://
schemas.microsoft.com/clr/nsassem/….”

When moving assembly ‘B’ to the process current directory, everything
works fine.

Does anyone know what is the cause of this problem and how can I get
over it?
Thanks,
Udi

[Serializable]
public class ChipLabProps
{
:
:
}

public ChipLabProps LoadProps()
{
using (FileStream fileStream = new FileStream(propFileName,
FileMode.OpenOrCreate, FileAccess.Read))
{
IFormatter formatter = new SoapFormatter();

return (ChipLabProps)formatter.Deserialize(fileStream);
}
}
 

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