PC Review


Reply
Thread Tools Rate Thread

"Cannot find assembly..." when deserializing from memorystream

 
 
Gabriel Lozano-Morán
Guest
Posts: n/a
 
      29th Nov 2005
I have a strange exception imo when I try to deserialize a memorystream to
an object using the following code:

public static object Clone(object sheep)
{
if (master == null)
{
throw new ArgumentNullException("sheep");
}
using (MemoryStream stream = new MemoryStream(4096))
{
object dolly = null;
BinaryFormatter formatter = new BinaryFormatter(null, new
StreamingContext(StreamingContextStates.Clone));
formatter.Serialize(stream, sheep);
stream.Seek(0, SeekOrigin.Begin);
dolly = formatter.Deserialize(stream);
return dolly;
}
}

The Exception is thrown by the formatter.Deserialize() method call: "cannot
find assembly x.dll...". For some reason the Deserialize() is trying to look
presumably in the GAC for the x.dll assembly. The object 'sheep' I am trying
to clone is in the same assembly as the utility class with the Clone()
method.

Anyone has experience this before? I am using .NET Framework v1.1.4322...

Gabriel Lozano-Morán


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deserialize causes exception "Unable to find assembly" sippyuconn Microsoft C# .NET 3 1st Dec 2008 09:17 AM
"Assembly.Load()" - How to find an assembly using an alternate path JohnE Microsoft C# .NET 0 13th Apr 2008 02:50 PM
"COM Interop registration failed. Could not find a type library for assembly 'Microsoft.VisualBasic'." =?Utf-8?B?Sm9obg==?= Microsoft Dot NET Framework 0 25th May 2004 02:06 PM
"COM Interop registration failed. Could not find a type library for assembly 'Microsoft.VisualBasic'." =?Utf-8?B?Sm9obg==?= Microsoft Dot NET Framework 0 25th May 2004 02:06 PM
System.Net.Socket.SocketException "Could not find resource assembly" Mete Kart via .NET 247 Microsoft Dot NET Compact Framework 0 13th May 2004 05:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:40 AM.