473,396 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

"Insufficient state to deserialize the object. More information is needed." AppDomain Load

I am using the code below and I am getting this error:
"Insufficient state to deserialize the object. More information is needed."
Has anyone seen this? It is working with other dll's but not on a certain
one. Can some help?


private void LoadAssembly(string DllLocationDirectory, string
applicationName, bool shadowCopyFiles, string friendlyName, string dllName,
string className)
{
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = DllLocationDirectory;
setup.ApplicationName = applicationName;
setup.ShadowCopyFiles = shadowCopyFiles.ToString();
setup.ShadowCopyDirectories = DllLocationDirectory;

this._AppDomain = AppDomain.CreateDomain(friendlyName, null, setup);

SetAppDomainPolicy(_AppDomain);

byte[] AssemblyBtyes = this.LoadAssemblyBytes(DllLocationDirectory +
dllName);
Assembly asm = this._AppDomain.Load(AssemblyBtyes);
this._ClassLoaded = asm.CreateInstance(className);
}

private byte[] LoadAssemblyBytes(string filename)
{
FileStream fin = new FileStream(filename, FileMode.Open,FileAccess.Read);
byte[] bin = new byte[16384];
long rdlen = 0;
long total= fin.Length;
int len;
MemoryStream memStream = new MemoryStream((int)total);
rdlen = 0;
while(rdlen < total)
{
len = fin.Read(bin, 0, 16384);
memStream.Write(bin, 0, len);
rdlen = rdlen + len;
}
// done with input file
fin.Close();
return memStream.ToArray();
}
Nov 16 '05 #1
3 3762
Sean McKaharay wrote:
I am using the code below and I am getting this error:
"Insufficient state to deserialize the object. More information is needed."
Has anyone seen this? It is working with other dll's but not on a certain
one. Can some help?

This error is caused because it can't load a particular assembly. Make sure
the assembly is findable, for example by placing it into the GAC or the
program directory of the .exe which is doing the deserialization.

Frans.
--
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #2
Fran,

It has to be deeper than that. When I try another dll it works.
"Frans Bouma [C# MVP]" <pe******************@xs4all.nl> wrote in message
news:xn***************@msnews.microsoft.com...
Sean McKaharay wrote:
I am using the code below and I am getting this error:
"Insufficient state to deserialize the object. More information is needed." Has anyone seen this? It is working with other dll's but not on a certain one. Can some help?

This error is caused because it can't load a particular assembly. Make

sure the assembly is findable, for example by placing it into the GAC or the
program directory of the .exe which is doing the deserialization.

Frans.
--
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP

Nov 16 '05 #3
Sean,

Can you give all the Exception information (call stack, message, etc,
etc), as well as the line it occurs on?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sean McKaharay" <se************@expoexchange.com> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...
I am using the code below and I am getting this error:
"Insufficient state to deserialize the object. More information is needed." Has anyone seen this? It is working with other dll's but not on a certain
one. Can some help?


private void LoadAssembly(string DllLocationDirectory, string
applicationName, bool shadowCopyFiles, string friendlyName, string dllName, string className)
{
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = DllLocationDirectory;
setup.ApplicationName = applicationName;
setup.ShadowCopyFiles = shadowCopyFiles.ToString();
setup.ShadowCopyDirectories = DllLocationDirectory;

this._AppDomain = AppDomain.CreateDomain(friendlyName, null, setup);

SetAppDomainPolicy(_AppDomain);

byte[] AssemblyBtyes = this.LoadAssemblyBytes(DllLocationDirectory +
dllName);
Assembly asm = this._AppDomain.Load(AssemblyBtyes);
this._ClassLoaded = asm.CreateInstance(className);
}

private byte[] LoadAssemblyBytes(string filename)
{
FileStream fin = new FileStream(filename, FileMode.Open,FileAccess.Read);
byte[] bin = new byte[16384];
long rdlen = 0;
long total= fin.Length;
int len;
MemoryStream memStream = new MemoryStream((int)total);
rdlen = 0;
while(rdlen < total)
{
len = fin.Read(bin, 0, 16384);
memStream.Write(bin, 0, len);
rdlen = rdlen + len;
}
// done with input file
fin.Close();
return memStream.ToArray();
}

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pankaj Jain | last post by:
Hi All, I have a class A which is derived from ServicesComponent to participate in automatic transaction with falg Transaction.Required. Class A is exposed to client through remoting on Http...
0
by: Sean McKaharay | last post by:
I am using the code below and I am getting this error: "Insufficient state to deserialize the object. More information is needed." Has anyone seen this? It is working with other dll's but not on a...
2
by: ce | last post by:
Being a newbie regarding serialization and memorystreams, I was trying to see if i could improve page performance (avoiding going to the db on a postback) by saving my serialized business object in...
4
by: JackBlack | last post by:
Hi, all! Need a little help tracking down a runtime error problem. I'm getting this error: "Unable to cast object of type 'myStruct' to type 'myStruct'... but the two types are identical! I...
0
by: ashluvcadbury | last post by:
Hi all I have visual studio 2003 and also configured IIS.But not able to execute any web application. I am a beginner and all the small web applications I had made some days days ago were...
1
by: manchin2 | last post by:
Hi, Can anybody please provide the information about "&quot" and its use, if possible please provide an example. ...
84
by: aarklon | last post by:
Hi all, I found an interesting article here:- http://en.wikipedia.org/wiki/Criticism_of_the_C_programming_language well what do you guys think of this article....??? Is it constructive...
1
by: mukeshgautam | last post by:
Hi Friends, I am transferring a access table into excel file, while transferring I am getting run time error '2391', and I am unable to resolve it, can any body help me why I am getting this...
0
by: CoreyReynolds | last post by:
Hey all, I have a piece of code that dumps a bunch of data into a spreadsheet. Also rearranges it into a pivot table and then graphs the pivot table as well so my boss can get a clear view of the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.