When trying to throw a custom exception from a COM+ component to a client
using an interface as suggested by microsoft i am getting an "Object
reference not set to an instance of an object."
However when executing the code outside of COM+ the application behaves
correctly.
Public Interface IExceptionGenerator
Sub GenerateException(ByVal Ex As Exception, ByVal SourceAssembly As
String, _
ByVal SourceModule As String, ByVal
SourceProcedure As String)
End Interface
<ClassInterface(ClassInterfaceType.AutoDual), _
Transaction(TransactionOption.Supported), _
Serializable()> _
Public Class ExceptionGenerator
Inherits ServicedComponent
Implements IExceptionGenerator
Public Sub New()
MyBase.new()
End Sub
Public Sub GenerateException(ByVal Ex As System.Exception, ByVal
SourceAssembly As String, ByVal SourceModule As String, ByVal SourceProcedure
As String) Implements IExceptionGenerator.GenerateException
Dim CustEx As New CustomException(Ex, SourceAssembly, SourceModule,
SourceProcedure)
Throw (CustEx)
End Sub
End Class 2 1121
this article might help: http://msdn.microsoft.com/msdnmag/is...M/default.aspx
HTH
Ollie Riches
"guy" <gu*@discussions.microsoft.com> wrote in message
news:E7**********************************@microsof t.com... When trying to throw a custom exception from a COM+ component to a client using an interface as suggested by microsoft i am getting an "Object reference not set to an instance of an object." However when executing the code outside of COM+ the application behaves correctly.
Public Interface IExceptionGenerator Sub GenerateException(ByVal Ex As Exception, ByVal SourceAssembly As String, _ ByVal SourceModule As String, ByVal SourceProcedure As String) End Interface
<ClassInterface(ClassInterfaceType.AutoDual), _ Transaction(TransactionOption.Supported), _ Serializable()> _ Public Class ExceptionGenerator Inherits ServicedComponent Implements IExceptionGenerator
Public Sub New() MyBase.new() End Sub
Public Sub GenerateException(ByVal Ex As System.Exception, ByVal SourceAssembly As String, ByVal SourceModule As String, ByVal SourceProcedure As String) Implements IExceptionGenerator.GenerateException
Dim CustEx As New CustomException(Ex, SourceAssembly, SourceModule, SourceProcedure) Throw (CustEx)
End Sub End Class
thanks Ollie, unfortunately thats the article we started from!
cheers
guy
"Ollie Riches" wrote: this article might help:
http://msdn.microsoft.com/msdnmag/is...M/default.aspx
HTH
Ollie Riches "guy" <gu*@discussions.microsoft.com> wrote in message news:E7**********************************@microsof t.com... When trying to throw a custom exception from a COM+ component to a client using an interface as suggested by microsoft i am getting an "Object reference not set to an instance of an object." However when executing the code outside of COM+ the application behaves correctly.
Public Interface IExceptionGenerator Sub GenerateException(ByVal Ex As Exception, ByVal SourceAssembly As String, _ ByVal SourceModule As String, ByVal SourceProcedure As String) End Interface
<ClassInterface(ClassInterfaceType.AutoDual), _ Transaction(TransactionOption.Supported), _ Serializable()> _ Public Class ExceptionGenerator Inherits ServicedComponent Implements IExceptionGenerator
Public Sub New() MyBase.new() End Sub
Public Sub GenerateException(ByVal Ex As System.Exception, ByVal SourceAssembly As String, ByVal SourceModule As String, ByVal SourceProcedure As String) Implements IExceptionGenerator.GenerateException
Dim CustEx As New CustomException(Ex, SourceAssembly, SourceModule, SourceProcedure) Throw (CustEx)
End Sub End Class This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mark Oueis |
last post by:
I've been struggling with this question for a while. What is better
design? To design functions to return error codes when an error
occures, or to have them throw exceptions.
If you chose the...
|
by: mihai |
last post by:
People say that is a bad technique to throw exception from
constructors; and that the solution would be to create a function
_create_ to initialize an object.
What about copy constructors? How...
|
by: Farooq Khan |
last post by:
i'm writing a class library having following code snippet. i want this class
to report an error (by throwing an Exception) to the application using this
class library. the problem is that within...
|
by: Kevin Yu |
last post by:
is it a bad programming design to throw exception in the try block then
catch it??
|
by: Sek |
last post by:
Gurus,
I am wondering whether it is right to throw an exception from a
Property of an object.
To get into it further, is it okay to throw exception during 'get'
operation?
I was searching...
|
by: Sridhar |
last post by:
Hi,
I would like to know the general procedure to throw exceptions. Lets say
I have a datagrid in my webpage and I am pulling the data for my webpage
using a function. The function accepts...
|
by: Sek |
last post by:
Is it appropriate to throw exception from a constructor?
Thats the only way i could think of to denote the failure of
constructor, wherein i am invoking couple of other classes to
initialise the...
|
by: usenet |
last post by:
I wrote some sample code (see below) for nested exception throwing
i.e. my catch blocks are throwing exceptions of their own (for
simplicity I used standard exceptions). I am getting some...
|
by: Jay Dee |
last post by:
I have a query about throwing exceptions.
To throw an exception I type something like:
try
{
// do somthing
}
catch (ArgumentOutOfRangeException)
{
|
by: Chris M. Thomasson |
last post by:
Is it every appropriate to throw in a dtor? I am thinking about a simple
example of a wrapper around a POSIX file...
________________________________________________________________________
class...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |