Cusom exceptions and COM+

  • Thread starter Thread starter Ollie
  • Start date Start date
O

Ollie

I am having problems with custom exceptions in COM+, I have read the article
in MSDN (march 2004) and implemented the correct features....

The custom exception class derives of ApplicationException and also has the
[Serializeable] attribute and has a
Serialization constructor and overriden implementation of GetObjectData....

[Serializable]
public class BaseException : System.ApplicationException,
ISerializable......


The COM+ component is used in an object pool and has the following
attrbitues

[Transaction(TransactionOption.Required,
Isolation=TransactionIsolationLevel.Serializable, Timeout=60)]
[ObjectPooling(Enabled=true, MinPoolSize=2, MaxPoolSize=20,
CreationTimeout=30)]
[ClassInterface(ClassInterfaceType.AutoDual)]
[EventTrackingEnabled (true)]
public class XXXX : ServicedComponent, IXXXX.....

Where IXXXX is the public interface.

Can anyone tell me why I am still only get System.Exception on the client
side of the COM+ boundary and not my custom exception

Cheers in advance

Ollie
 
Cheers for the reply Nick, I have re-read the article and now see my
mistake, but from your comment do you think passing custom exceptions from
serviced components should be discouraged?

Cheers

Ollie

Nicholas Paldino said:
Ollie,

Custom exceptions being thrown from a serviced component are an ugly
thing. Check out the article in MSDN titled "Throwing Custom Exception
Types from a Managed COM+ Server Application", located at (watch for line
wrap):

http://msdn.microsoft.com/msdnmag/issues/04/03/ExceptionsinCOM/default.aspx

It will explain the issues involved.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ollie said:
I am having problems with custom exceptions in COM+, I have read the article
in MSDN (march 2004) and implemented the correct features....

The custom exception class derives of ApplicationException and also has the
[Serializeable] attribute and has a
Serialization constructor and overriden implementation of GetObjectData....

[Serializable]
public class BaseException : System.ApplicationException,
ISerializable......


The COM+ component is used in an object pool and has the following
attrbitues

[Transaction(TransactionOption.Required,
Isolation=TransactionIsolationLevel.Serializable, Timeout=60)]
[ObjectPooling(Enabled=true, MinPoolSize=2, MaxPoolSize=20,
CreationTimeout=30)]
[ClassInterface(ClassInterfaceType.AutoDual)]
[EventTrackingEnabled (true)]
public class XXXX : ServicedComponent, IXXXX.....

Where IXXXX is the public interface.

Can anyone tell me why I am still only get System.Exception on the client
side of the COM+ boundary and not my custom exception

Cheers in advance

Ollie
 
Ollie,

I don't think that it should be discouraged, not at all. It's just a
pain, given the differences between the exception system of .NET and the
HRESULT-based error system of COM/COM+.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ollie said:
Cheers for the reply Nick, I have re-read the article and now see my
mistake, but from your comment do you think passing custom exceptions from
serviced components should be discouraged?

Cheers

Ollie

message news:[email protected]...
Ollie,

Custom exceptions being thrown from a serviced component are an ugly
thing. Check out the article in MSDN titled "Throwing Custom Exception
Types from a Managed COM+ Server Application", located at (watch for line
wrap):
http://msdn.microsoft.com/msdnmag/issues/04/03/ExceptionsinCOM/default.aspx
It will explain the issues involved.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ollie said:
I am having problems with custom exceptions in COM+, I have read the article
in MSDN (march 2004) and implemented the correct features....

The custom exception class derives of ApplicationException and also
has
the
[Serializeable] attribute and has a
Serialization constructor and overriden implementation of GetObjectData....

[Serializable]
public class BaseException : System.ApplicationException,
ISerializable......


The COM+ component is used in an object pool and has the following
attrbitues

[Transaction(TransactionOption.Required,
Isolation=TransactionIsolationLevel.Serializable, Timeout=60)]
[ObjectPooling(Enabled=true, MinPoolSize=2, MaxPoolSize=20,
CreationTimeout=30)]
[ClassInterface(ClassInterfaceType.AutoDual)]
[EventTrackingEnabled (true)]
public class XXXX : ServicedComponent, IXXXX.....

Where IXXXX is the public interface.

Can anyone tell me why I am still only get System.Exception on the client
side of the COM+ boundary and not my custom exception

Cheers in advance

Ollie
 
Back
Top