By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,693 Members | 1,936 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,693 IT Pros & Developers. It's quick & easy.

Cusom exceptions and COM+

P: n/a
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
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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/is...M/default.aspx

It will explain the issues involved.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ollie" <ol**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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

Nov 16 '05 #2

P: n/a
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 [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:Oy**************@TK2MSFTNGP10.phx.gbl...
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/is...M/default.aspx
It will explain the issues involved.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ollie" <ol**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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


Nov 16 '05 #3

P: n/a
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]
- mv*@spam.guard.caspershouse.com

"Ollie" <ol**********@hotmail.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
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 [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in message news:Oy**************@TK2MSFTNGP10.phx.gbl...
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/is...M/default.aspx

It will explain the issues involved.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Ollie" <ol**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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



Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.