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
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