473,408 Members | 1,738 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,408 software developers and data experts.

How to serialize a C++ object through .Net Remoting

Below is a custom exception class that I created to be shared by my C+
+ and
C# code. It works fine till I need to pass the exception object
through Remoting: every time a FtException is raized in the Remoting
server side, the client got the following error (see below). Based on
my Google search, I did the best I can to have a constructor that
takes SerializationInfo and StreamingContext as input. But it seemed
that
client side still cannot get the constructor to deserialize
FtException object.
What did I do wrong???

Also, how do I write the construction (right now is just a printf
statemet :-) so that I can pass the _errMsg, and _errNo members and
recreate the object on the client side.

Thanks in advance,

Ben

================================================== ==========
[Serializable]
public __gc class FtException : public System::Exception
{
public:
String *_errMsg;
int _errNo;

FtException(System::Runtime::Serialization::Serial izationInfo __gc*
info,
System::Runtime::Serialization::StreamingContext __gc* context);
FtException(int errNo, String* errMsg);
System.Runtime.Serialization.SerializationExceptio n: The constructor
to deserialize an object of type Ft.ServiceUtils.FtException was not
found.

Server stack trace:

at
System.Runtime.Serialization.ObjectManager.Complet eISerializableObject(Object
obj, SerializationInfo info, StreamingContext context)
at
System.Runtime.Serialization.ObjectManager.FixupSp ecialObject(ObjectHolder
holder)
at System.Runtime.Serialization.ObjectManager.DoFixup s()
at
System.Runtime.Serialization.Formatters.Soap.Objec tReader.Deserialize(HeaderHandler
handler, ISerParser serParser)
at
System.Runtime.Serialization.Formatters.Soap.SoapF ormatter.Deserialize(Stream
serializationStream, HeaderHandler handler)
at
System.Runtime.Remoting.Channels.CoreChannel.Deser ializeSoapResponseMessage(Stream
inputStream, IMessage requestMsg, Header[] h, Boolean bStrictBinding)
at
System.Runtime.Remoting.Channels.SoapClientFormatt erSink.DeserializeMessage(IMethodCallMessage
mcm, ITransportHeaders headers, Stream stream)
at
System.Runtime.Remoting.Channels.SoapClientFormatt erSink.SyncProcessMessage(IMessage
msg)

Exception rethrown at [0]:
at Ft.FTConsole.OptionsDialog.tbPolicyServer_KeyUp(Ob ject sender,
KeyEventArgs e) in ....

Jul 31 '07 #1
3 2136
be*****@gmail.com wrote:
Below is a custom exception class that I created to be shared by my C+
+ and
C# code. It works fine till I need to pass the exception object
through Remoting: every time a FtException is raized in the Remoting
server side, the client got the following error (see below). Based on
my Google search, I did the best I can to have a constructor that
takes SerializationInfo and StreamingContext as input. But it seemed
that
client side still cannot get the constructor to deserialize
FtException object.
What did I do wrong???

Also, how do I write the construction (right now is just a printf
statemet :-) so that I can pass the _errMsg, and _errNo members and
recreate the object on the client side.
[Serializable]
public __gc class FtException : public System::Exception
{
public:
String *_errMsg;
int _errNo;

FtException(System::Runtime::Serialization::Serial izationInfo __gc*
info,
System::Runtime::Serialization::StreamingContext __gc* context);
FtException(int errNo, String* errMsg);
System.Runtime.Serialization.SerializationExceptio n: The constructor
to deserialize an object of type Ft.ServiceUtils.FtException was not
found.
I think you need a constructor with no arguments.

Arne

PS: This is a C# group.
Aug 1 '07 #2
On Jul 31, 5:47 pm, Arne Vajhøj <a...@vajhoej.dkwrote:
benk...@gmail.com wrote:
Below is a custom exception class that I created to be shared by my C+
+ and
C# code. It works fine till I need to pass the exception object
through Remoting: every time a FtException is raized in the Remoting
server side, the client got the following error (see below). Based on
my Google search, I did the best I can to have a constructor that
takes SerializationInfo and StreamingContext as input. But it seemed
that
client side still cannot get the constructor to deserialize
FtException object.
What did I do wrong???
Also, how do I write the construction (right now is just a printf
statemet :-) so that I can pass the _errMsg, and _errNo members and
recreate the object on the client side.
[Serializable]
public __gc class FtException : public System::Exception
{
public:
String *_errMsg;
int _errNo;
FtException(System::Runtime::Serialization::Serial izationInfo __gc*
info,
System::Runtime::Serialization::StreamingContext __gc* context);
FtException(int errNo, String* errMsg);
System.Runtime.Serialization.SerializationExceptio n: The constructor
to deserialize an object of type Ft.ServiceUtils.FtException was not
found.

I think you need a constructor with no arguments.

Arne

PS: This is a C# group.
Thanks for the reply. I added an constructor w/ no arguments
"FtException()".
But the same error of
"System.Runtime.Serialization.SerializationExcepti on" is
still there.

Ben

PS. I believe my question is still C# related. And I hope I am not the
only
C# developer that needs to struggle with the integration with an
existing
C++ library...

Aug 1 '07 #3

If you look at your assembly in a decompiler (Reflector) is the
constructor there? Seems like an odd problem, the only thing that
causes that error is missing the SerializationInfo, StreamingContext
constructor but you have it declared.

Not that it matters for this problem, but the serialization
constructor is usually declared protected.

While this may be related to c# integration, sounds like a weird
c++/cli problem and you may have better luck in a different group.

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Tue, 31 Jul 2007 15:05:31 -0700, be*****@gmail.com wrote:
>================================================= ===========
[Serializable]
public __gc class FtException : public System::Exception
{
public:
String *_errMsg;
int _errNo;

FtException(System::Runtime::Serialization::Serial izationInfo __gc*
info,
System::Runtime::Serialization::StreamingContext __gc* context);
FtException(int errNo, String* errMsg);
System.Runtime.Serialization.SerializationExcepti on: The constructor
to deserialize an object of type Ft.ServiceUtils.FtException was not
found.

Server stack trace:

at
System.Runtime.Serialization.ObjectManager.Comple teISerializableObject(Object
obj, SerializationInfo info, StreamingContext context)
Aug 1 '07 #4

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

Similar topics

2
by: Rachel Suddeth | last post by:
? I have seen apparently different meanings... If you say "designer serialization", it seems to mean that a setting is put into "InitializeComponent" by the designer. Then remoting stuff talks...
14
by: vince | last post by:
Can I add (append) to an xml file that already contains a serialized object, and be able to deserialize to either or both objects from the same file...??? How is this done...?? thanks, vince
5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
10
by: Dan | last post by:
All I Am Attempting To Serialize An Object To An XML File. Here Is The Code For That public string SaveNewSurvey( MutualSurveyObject mso_TempObject, int i_JobID ) { string s_RootFileName;...
0
by: Ken Durden | last post by:
I'm getting the following exception coming out of a block of unmanaged C++ code. Thread executed for 1.03 sec and died with the following exception: External component has thrown an exception. ...
3
by: GoodMorningSky | last post by:
I have long term question about object serialization. Object serialization is used in many ways. In .net I heard XML is used for object serialization. I understand how object values are serialized...
1
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In...
2
by: =?Utf-8?B?VGhlTWFkSGF0dGVy?= | last post by:
oop Q: If I serialize an interface array, then later deserialize it, do I need the original assembly to deserialize it??? Eg: // Inside of "globaly assembly" public interface Ianimal {
3
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, I am using dotnet remoting with a binarry formatter. I have a property that returns a memorystream that has had a file loaded into it. When I try to access this property though I get an...
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: 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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
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
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...
0
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...
0
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...

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.