473,986 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

I am using the code below and I am getting this error:
"Insufficie nt 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(st ring DllLocationDire ctory, string
applicationName , bool shadowCopyFiles , string friendlyName, string dllName,
string className)
{
AppDomainSetup setup = new AppDomainSetup( );
setup.Applicati onBase = DllLocationDire ctory;
setup.Applicati onName = applicationName ;
setup.ShadowCop yFiles = shadowCopyFiles .ToString();
setup.ShadowCop yDirectories = DllLocationDire ctory;

this._AppDomain = AppDomain.Creat eDomain(friendl yName, null, setup);

SetAppDomainPol icy(_AppDomain) ;

byte[] AssemblyBtyes = this.LoadAssemb lyBytes(DllLoca tionDirectory +
dllName);
Assembly asm = this._AppDomain .Load(AssemblyB tyes);
this._ClassLoad ed = asm.CreateInsta nce(className);
}

private byte[] LoadAssemblyByt es(string filename)
{
FileStream fin = new FileStream(file name, FileMode.Open,F ileAccess.Read) ;
byte[] bin = new byte[16384];
long rdlen = 0;
long total= fin.Length;
int len;
MemoryStream memStream = new MemoryStream((i nt)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.ToArr ay();
}
Nov 16 '05 #1
3 3790
Sean McKaharay wrote:
I am using the code below and I am getting this error:
"Insufficie nt 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.n l> wrote in message
news:xn******** *******@msnews. microsoft.com.. .
Sean McKaharay wrote:
I am using the code below and I am getting this error:
"Insufficie nt 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.co m

"Sean McKaharay" <se************ @expoexchange.c om> wrote in message
news:O7******** ******@TK2MSFTN GP12.phx.gbl...
I am using the code below and I am getting this error:
"Insufficie nt 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(st ring DllLocationDire ctory, string
applicationName , bool shadowCopyFiles , string friendlyName, string dllName, string className)
{
AppDomainSetup setup = new AppDomainSetup( );
setup.Applicati onBase = DllLocationDire ctory;
setup.Applicati onName = applicationName ;
setup.ShadowCop yFiles = shadowCopyFiles .ToString();
setup.ShadowCop yDirectories = DllLocationDire ctory;

this._AppDomain = AppDomain.Creat eDomain(friendl yName, null, setup);

SetAppDomainPol icy(_AppDomain) ;

byte[] AssemblyBtyes = this.LoadAssemb lyBytes(DllLoca tionDirectory +
dllName);
Assembly asm = this._AppDomain .Load(AssemblyB tyes);
this._ClassLoad ed = asm.CreateInsta nce(className);
}

private byte[] LoadAssemblyByt es(string filename)
{
FileStream fin = new FileStream(file name, FileMode.Open,F ileAccess.Read) ;
byte[] bin = new byte[16384];
long rdlen = 0;
long total= fin.Length;
int len;
MemoryStream memStream = new MemoryStream((i nt)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.ToArr ay();
}

Nov 16 '05 #4

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

Similar topics

0
7398
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 channal hosting into IIS. There is a class B which is also available through remoting hosted on IIS on the same URI. B creates new of A inside a function. It succeed and able to create instance of A inside B first time. But it failes in 2nd attempt when...
0
1531
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 certain one. Can some help? private void LoadAssembly(string DllLocationDirectory, string applicationName, bool shadowCopyFiles, string friendlyName, string dllName,
2
8014
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 viewstate and getting it back from the client on a postback. But the last line of the sample code below throws a "Stream was not readable" error when i'm trying to get the serialized object back out of the viewstate and memorystream. Any...
4
2473
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 have a class method that's building an array of user-defined structures (see below), and returning that array to the calling routine. I'm getting the error on that calling line. The structure in both the webform and class are defined like this:
0
1175
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 working perfectly .But now when i tried to execute them again ,they are giving the error"Http error-404 object not found" .what should I do.Please help me out. thanks and regards
1
2852
by: manchin2 | last post by:
Hi, Can anybody please provide the information about "&quot" and its use, if possible please provide an example. 1)<tm:bom-expression>{Conf.getEquityConfLookupFields().getEventFieldText(&quot;AdditionalDisruption&quot;,&quot;Change in Law&quot;)}</tm:bom-expression> 2)07:41:08 Default ( call ( . ( call ( . Conf getEquityConfLookupFields ) ) getEventFieldText ) ( , AdditionalDisruption Change inLaw ) ) value=Not applicable Can you please...
84
8672
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 criticism that needs to be appreciated always...???
1
3469
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 error. Thanks in Advance Here is my code:- app.docmd.TransferSpreadsheet acExport, 8, "tblAdjustmentMasterCreated Step1", "M:\SecureOR&A\OR&A 2007\Automation\Mukesh\Adjustment\closed_step_1.xls", True, ""
0
3445
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 data. This question is two part. One, I seem to be getting the title error at the starting line stating: oSheet.Range(rng).Select With Selection shp.Left = .Left shp.Top = .Top
0
11895
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11477
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10140
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4810
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.