PDA

View Full Version : Com Server Callback


Michael Seelig
29-Aug-2005, 08:24 PM
I found a bug using the EurekaLog. Under the following circumstances
Eurekalog shows the exception dialog, even when the error is running in a
try .. except section:

1. Create an ActiveX Automation Object in a ActiveX Library (DLL), which has
a property to set another callback Object, be shure to turn off EurekaLog
Exception Handler:

IEurekaCallBackTest = interface(IUnknown)
['{C9D2C7AC-86E0-4163-8EE9-163158266EE6}']
procedure Test; safecall;
end;

TEurekaTest = class(TAutoObject, IEurekaTest)
private
FEurekaCallBackTest: IEurekaCallBackTest;
protected
function Get_EurekaCallbackTest: IEurekaCallBackTest; safecall;
procedure Set_EurekaCallbackTest(const Value: IEurekaCallBackTest);
safecall;
procedure Execute; safecall;
end;

function TEurekaTest.Get_EurekaCallbackTest: IEurekaCallBackTest;
begin
result := FEurekaCallBackTest;
end;

procedure TEurekaTest.Set_EurekaCallbackTest(const Value:
IEurekaCallBackTest);
begin
FEurekaCallBackTest := Value;
end;

procedure TEurekaTest.Execute;
begin
if Assigned(FEurekaCallBackTest) then
FEurekaCallbackTest.Test;
end;

2. Create an executable application (EurekaLog handler activated)
3. Implement the IEurekaCallBackTest interface as followed:

TEurekaCallBackTest = class(TInterfacedObject,IEurekaCallBackTest)
protected
procedure Test; safecall;
end;

procedure TEurekaCallBackTest.Test;
begin
raise Exception.Create('Error should not be handled by EurekaLog!');
end;

4. Create an TEurekaTest Object
5. Create an TEurekaCallBackTest Object
6. Set the EurekaTest.EurekaCallbackTest Property to the new created
TEurekaCallbackTest object
7. Execute the EurekaTest.Execute Method within a try..except section

var
e: IEurekaTest;
begin
e := CoEurekaTest.Create;
e.EurekaCallbackTest := TEurekaCallBackTest.Create;
try
try
e.Execute; '<-- this line calls the Automation Object, the Automation
Object calls our Test Method from
' the TEurekaCallbackTest Object which is implemented
in our main application.
' In the Test Method an exception is raised and
EurekaLog is showing the exception dialog :-(
except
end;
finally
e.EurekaCallbackTest := nil;
e := nil;
end;

8. While running the code, the Eureka dialog will appear.

Full sample code is in the attachment. (Do not forget to register the DLL)

Best Regards
Michael

admin
16-Sep-2005, 11:14 AM
Michael Seelig wrote:
> I found a bug using the EurekaLog. Under the following circumstances
> Eurekalog shows the exception dialog, even when the error is running in a
> try .. except section:
>
> [...]
>
> Full sample code is in the attachment. (Do not forget to register the DLL)
>
> Best Regards
> Michael

This isn't a bug but a wanted behavior.
EurekaLog handled every exception raised in a "safecall"
method/procedure always.

This because the safecall calling conversion is usually used to realize
the COM clients.

The COM clients are external to the server so EurekaLog cannot detect if
the client method is called by the server in a try/except block.

So handled every COM client exceptions.

What do you think about?

Any suggestion?


--
Best regards...

Fabio Dell'Aria.

Michael Seelig
21-Sep-2005, 08:06 AM
Hi Fabio,

> The COM clients are external to the server so EurekaLog cannot detect if
> the client method is called by the server in a try/except block.

did you recognized, that the try except IS in the client and therefore I
cannot understand why EurekaLog is not able (while the exception is handled
by Eureka in the Client app!) to find out if a try/except is around the
server call!

client:
try
servercall
except
end;

if the servercall ends up in an exception, the EurekaLog in the client is
showing me the exception!

Delphi has not the same behaviour, and also ExceptionMagic can handle this
problem.

Regards,
Michael


"admin" <support@eurekalog.com> wrote in message
news:dge5sq$nub$1@server.eurekalog.com...
> Michael Seelig wrote:
>> I found a bug using the EurekaLog. Under the following circumstances
>> Eurekalog shows the exception dialog, even when the error is running in a
>> try .. except section:
>>
>> [...]
>>
>> Full sample code is in the attachment. (Do not forget to register the
>> DLL)
>>
>> Best Regards
>> Michael
>
> This isn't a bug but a wanted behavior.
> EurekaLog handled every exception raised in a "safecall" method/procedure
> always.
>
> This because the safecall calling conversion is usually used to realize
> the COM clients.
>
> The COM clients are external to the server so EurekaLog cannot detect if
> the client method is called by the server in a try/except block.
>
> So handled every COM client exceptions.
>
> What do you think about?
>
> Any suggestion?
>
>
> --
> Best regards...
>
> Fabio Dell'Aria.

admin
21-Sep-2005, 04:21 PM
Michael Seelig wrote:
> Hi Fabio,
>
>
>>The COM clients are external to the server so EurekaLog cannot detect if
>>the client method is called by the server in a try/except block.
>
>
> did you recognized, that the try except IS in the client and therefore I
> cannot understand why EurekaLog is not able (while the exception is handled
> by Eureka in the Client app!) to find out if a try/except is around the
> server call!
>
> client:
> try
> servercall
> except
> end;
>
> if the servercall ends up in an exception, the EurekaLog in the client is
> showing me the exception!
>
> Delphi has not the same behaviour, and also ExceptionMagic can handle this
> problem.
>
> Regards,
> Michael
>
>
> [...]

Yes, it's true.
I think to add a new option in the next versions so to can choose if
handle all safecall exceptions or not.

What do you think about? :)

--
Best regards...

Fabio Dell'Aria.

Michael Seelig
21-Sep-2005, 04:31 PM
Hi Fabio

> I think to add a new option in the next versions so to can choose if
> handle all safecall exceptions or not.

of course this is better than having no choice... :-)

Best regards
Michael


"admin" <support@eurekalog.com> wrote in message
news:dgrtnh$4a0$1@server.eurekalog.com...
> Michael Seelig wrote:
>> Hi Fabio,
>>
>>
>>>The COM clients are external to the server so EurekaLog cannot detect if
>>>the client method is called by the server in a try/except block.
>>
>>
>> did you recognized, that the try except IS in the client and therefore I
>> cannot understand why EurekaLog is not able (while the exception is
>> handled by Eureka in the Client app!) to find out if a try/except is
>> around the server call!
>>
>> client:
>> try
>> servercall
>> except
>> end;
>>
>> if the servercall ends up in an exception, the EurekaLog in the client is
>> showing me the exception!
>>
>> Delphi has not the same behaviour, and also ExceptionMagic can handle
>> this problem.
>>
>> Regards,
>> Michael
>>
>>
>> [...]
>
> Yes, it's true.
> I think to add a new option in the next versions so to can choose if
> handle all safecall exceptions or not.
>
> What do you think about? :)
>
> --
> Best regards...
>
> Fabio Dell'Aria.

admin
21-Sep-2005, 04:45 PM
Michael Seelig wrote:
> Hi Fabio
>
>
>>I think to add a new option in the next versions so to can choose if
>>handle all safecall exceptions or not.
>
>
> of course this is better than having no choice... :-)
>
> Best regards
> Michael
>
>
> "admin" <support@eurekalog.com> wrote in message
> news:dgrtnh$4a0$1@server.eurekalog.com...
>
>>Michael Seelig wrote:
>>
>>>Hi Fabio,
>>>
>>>
>>>
>>>>The COM clients are external to the server so EurekaLog cannot detect if
>>>>the client method is called by the server in a try/except block.
>>>
>>>
>>>did you recognized, that the try except IS in the client and therefore I
>>>cannot understand why EurekaLog is not able (while the exception is
>>>handled by Eureka in the Client app!) to find out if a try/except is
>>>around the server call!
>>>
>>>client:
>>>try
>>> servercall
>>>except
>>>end;
>>>
>>>if the servercall ends up in an exception, the EurekaLog in the client is
>>>showing me the exception!
>>>
>>>Delphi has not the same behaviour, and also ExceptionMagic can handle
>>>this problem.
>>>
>>>Regards,
>>>Michael
>>>
>>>
>>>[...]
>>
>>Yes, it's true.
>>I think to add a new option in the next versions so to can choose if
>>handle all safecall exceptions or not.
>>
>>What do you think about? :)
>>
>>--
>>Best regards...
>>
>>Fabio Dell'Aria.

Only one answer.
Can you add a new thread in the suggestion forum, relative to this new
feature, please?
Just to discuss the question in the exact forum, no? :)


--
Best regards...

Fabio Dell'Aria.