Exception's properties not working.
Status: Beta
Brought to you by:
kris_johnson
I have a full working project with an IDL I imported using
IDL2CS, and everything works fine, except for the fact
that none of the exception's have its properties filled.
The company that made the IDL just swears that this
properties are being filled on the server-side, but I can't
get its values. Do you have any idea what could be
happening? Thanks in advance.
potiguar@potiguar.net
Logged In: YES
user_id=565214
Had the same problem. Seems like a Remoting.Corba Library.
The docs state that you should provide a constructor with
the same parameter types as the fields in your exception
class. Forget about it since no constructor gets called. The
Remoting.Corba library gets an instance via a
FormatterServices.GetUninitializedObject call, which calls no
constructor.
I resolved the problem by overriding the Deserialize method:
public new void Deserialize(GiopDeserializationContext
context) {
base.Deserialize(context);
exceptionType=(ExceptionType_T)
context.ReadObject(typeof(ExceptionType_T));
errorReason=(string)context.ReadObject(typeof
(string));
}
where exceptionType and errorReason are the two fields of
the CorbaUserException derived class, respectively of types
ExceptionType_T (an enum), and string. Please note that I
also had to derive from the ICdrSerializable interface to get
the exception working.
Please let me know if this approach managed to solve the
problem.
I'd also like to hear from Kristopher if my explanation makes
sense. Thanks Kristopher!