|
I have 2 applications in which I serialize data in one and deserialize data in the other utilizing the binary formatter. However, whenever I try to deserialize, I get the following exception error:
"An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll. Additional information: Unable to find assembly 'projectname, Version=1.0.XXXX.XXXX, Culture=neutral, PublicKeyToken=null'.
I tried to resolve the assembly that it is trying to find by using the System::ResolveEventHandler delegate and registering this method with the System::AppDomain's AssemblyResolve event before calling the Deserialize method. The problem is the ResolveEventHandler never gets fired, so I can't even attempt to load the assembly and consequently, it always fails at deserialization. Are there any ideas of what I am doing wrong or any examples of code I can look at?
|
|
|
|
|
I don't know if I understand it right. The error happens normally only if in the data which is deserialized are classes from an assembly which is not known in your project. Do you have a reference to this assembly in your second project?
Best regards
Hansjörg
|
|
|
|
|
Yes, I have referenced the assembly in my second project. I found that I was unable to fire the ResolveEventHandler because there was a copy of the first executable in the same directory as my second executable. When I removed this first executable from the same directory, the ResolveEventHandler gets fired. However, now I am having issues with Assembly::Load. It appears that this Assembly::Load is getting called over and over without ever returning the assembly. Eventually, I get a stack overflow exception error. Any ideas?
|
|
|
|
|
I'm pretty new to C++/CLI so please bare with me. I have a header "MyThread.h" that contains a Thread class. I added an include directive at the top of my frmMain.h so i can create an instance of this class. Everything is fine with that but when i include frmMain.h to MyThread.h i get alot of compile errors. I read somewhere of where you could add something like:
#ifndef FRMMAIN_H
#define FRMMAIN_H
#endif
to fix the issue but it isn't working. Any ideas?
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
In one of the header files, you'll probably need a forward reference to avoid circular reference
problems.
Here's one way:
#pragma once
class CfrmMain;
class CMyThread
{
CfrmMain *pMainFrame;
};
#include "stdafx.h"
#include "MyThread.h"
#include "frmMain.h"
...
#pragma once
#include "MyThread.h"
class CfrmMain
{
CMyThread *pMyThread;
};
#include "stdafx.h"
#include "frmMain.h"
...
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
I have observed that, when we create an empty class, it takes 1bite space. I don’t know why it takes 1bit space. Will there be any implicit function created when we create an empty class??
Thanks,
Nandu.
|
|
|
|
|
This is using C++/CLI, or are you in the wrong forum ?
I don't see how you can decide that an empty class takes up one byte. One byte where ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: One byte where ?
He said one 'Bite'. Maybe it's an animal class or something.
led mike
|
|
|
|
|
Hi Nandu,
There will not be any implicit functions created. However it just follows the simple rule
"Types can not be of ZERO size".
Cheers,
Suresh
|
|
|
|
|
Function does not need space (data)...
|
|
|
|
|
|
Hi everyone,
I am using mysql 5.0.
I have a problem with my c++ application using mysql.
I compiled everything without any trouble.
Localy appliction works perfectly but when I upload it crash comes emediately.
Remotely I cannot use any function regarding mysql.
When I use mysql_init() application crashes.
Whitout mysql application is working.
On the server installed version of mysql is 5.027.
I cannot understand mistake.
If anyone can help me I would appreciate it very much.
an-arhos
Edit/Delete Message
|
|
|
|
|
What do you mean by crash?
How does this relate to managed C++?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
The first three posts in this forum invoke a giant and produce visions of Fish Filet
led mike
|
|
|
|
|
Definitely! I'm torn - I'm not sure if the first or the third is "better"!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
O M G
Thanks man!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I was thinking we should start a FFOTD Award (Fish Filet of The Day) but I became concerned that McD's might not be able to keep up.
Also did you see my reply where I offered this Google Search[^]
I think I will be using that fairly often.
led mike
|
|
|
|
|
led mike wrote: I became concerned that McD's might not be able to keep up.
Yeah - I'm not sure about them keeping enough in stock, but there should be no shortage of
employees to prepare them!
led mike wrote: this Google Search[^]
Excellent! It's so good I'm not sure if I should laugh or sigh
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Is there any link which talks about file handling in mc++.
I have to specify the write mode for the file. I mixed both managed and unmanged code. From managed code i have to call unmanged code with the first parameter file name second parameter file mode(write mode)..How to specify the file mode.
pOap->Open(szTemp,FileWriteMode);
|
|
|
|
|
Hello ...If I have values for "H","D" given from the interface and I want put a message if the value for D from the interface is grater then 2*H
(let say I give value from the inteface for H=230 and for D=700 but 700>2*H to show me an error that "You must specify D less than 460 "
if (D > 2*H)
{
MessageBox::Show("You must specify D less then ......2*230(2*H).... ", "Error", MessageBoxButtons::OK, MessageBoxIcon::Error, MessageBoxDefaultButton::Button1/*, MessageBoxOptions.DefaultDesktopOnly*/);
return;
}
Y don't know if I can use MessageBox for this..can you help me...please
|
|
|
|
|
You could use String.Format() to format the string...
MessageBox::Show(String::Format("You must specify D less then {0} (2*H)", (H*2).ToString()),
"Error", MessageBoxButtons::OK, MessageBoxIcon::Error, MessageBoxDefaultButton::Button1/*,
MessageBoxOptions.DefaultDesktopOnly*/);
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
if (D > 2*H)
{
AfxMessageBox(CString("You must specify D less then ......2*230(2*H).... "));
return;
}
It will work.
Anurag Gandhi.
Bangalore, India.
|
|
|
|
|
|
When i compile my application in release mode i am getting the below warning
Warning 1 warning LNK4248: unresolved typeref token (0100001E) for 'CRawChro'; image may not run FConvert.obj
But there is no class or variable or struct whi the name CRawChro.
Where to look for this kind of warning.
Thanks in advance.
Regards, Eswari
|
|
|
|