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();
} 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
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
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(); }
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
by: manchin2 |
last post by:
Hi,
Can anybody please provide the information about """ and its use, if possible please provide an example.
...
|
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
|
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,...
| |