The latest release

delphi package - automated exception handling

The latest release

Postby altheeldr » Tue Apr 20, 2004 9:36 pm

I'm not sure what happened, but the latest release hangs my PC so badly that I can't even get task manager to display when an exception occurs (either when running from the IDE or independently.)

My registered exception handler allows for three types of output - writing to an exisiting window, displaying a new window, using the standard madExcept window. There is an option in the program for the user to choose his preference and test it out.

This worked quite alright up until i installed this release. After I figured out that I needed to change the calling sequence of the registered handlers to match the new sequence UGH!!! I rebuilt the program and ran the test option. :( It worked for the direct write to the existing window. It failed to bring up either my message window OR the mad window. And it tied up the PC sooooo badly that it took minutes to get it shut down!!!

I AM NOT A HAPPY CAMPER HERE AS I WAS GOING INTO PRODUCTION THIS WEEK. THIS HAS COST ME WAY TOO MUCH TIME AND EFFORT. Unfortunately the mad collection was central to my error handling and integrated into options and help.

I sure hope that when I go back to the previous release things will work.

Code snippets upon request if that would help at all.
altheeldr
 
Posts: 11
Joined: Tue Apr 20, 2004 9:27 pm

Postby madshi » Wed Apr 21, 2004 8:03 am

First of all I'm sorry for the problems.

Which version did you use before? The last version is still available for download here:

http://madshi.net/madCollection2.1.0.2.exe

Hmmm... Now on to the problem: Can you reproduce the crashes with a brand new (almost empty) application? If you can, could you please send that test project (including sources, exe, etc) to me?

Have you copied/changed madExcept.pas somewhen somewhere? Is it possible that on your harddisk there's an old madExcept.pas or madExcept.dcu flying around somewhere?

Could you please uninstall all my components, then search your harddisk for "mad" and delete all what belongs to my collection. Then reinstall and check whether the problem is gone.

Thanks...
madshi
Site Admin
 
Posts: 10209
Joined: Sun Mar 21, 2004 5:25 pm

Status of new release

Postby altheeldr » Wed Apr 21, 2004 10:44 am

I was able to go back to the previous release and things worked just fine thank you.

The MadCollection.exe that is working is dated 03/09/04.

At the time i did the testing I had installed the new stuff but had not uninstalled the old.

I can't take the time at this point to work on it much more, will look at it after I get my stuff out the door.
altheeldr
 
Posts: 11
Joined: Tue Apr 20, 2004 9:27 pm

Postby madshi » Wed Apr 21, 2004 10:51 am

I've increased the length of some madExcept strings which you can configure in the madExcept settings dialog. The madExcept wizard which is installed into the Delphi IDE patches your executable by writing those strings into your executable. Now if you're using an old madExcept.pas/dcu with the new IDE wizard, the old madExcept has only room for e.g. 100 chars, while the wizard writes 255 chars. As a result your exe gets destroyed.

My guess is that this is the problem you experienced. Somehow there must have been an old madExcept.pas/dcu somewhere in your folders.
madshi
Site Admin
 
Posts: 10209
Joined: Sun Mar 21, 2004 5:25 pm

Postby madshi » Wed Apr 21, 2004 10:52 am

P.S: I understand that you can't invest much time right now. But one test should be done quite fast (costs only 3 minutes of time):

(1) Uninstall madCollection completely.
(2) Search your harddisk for madExcept.*.

Do you find such files? Then there's something wrong. There should be no such files on your harddisk after you uninstalled the collection.
madshi
Site Admin
 
Posts: 10209
Joined: Sun Mar 21, 2004 5:25 pm

Postby altheeldr » Wed Apr 21, 2004 11:32 am

1. Cleaned house.
2. Installed latest release.
3. Fixed the routines' calling sequences to work with it.
4. Ran it with break points set at beginning of routines and task manager running (essential for your sanity)
5. Raised an exception.
6. BP's never were reached and taskmanager went to 98% utilization for my program. Even killing program took effort!

Here are the routines in question as modified:
unit uErrors;
{Copyright 2004 by Three Bears Software, LLC}
{to use this setupError must called first thing in the project code
the resume program button is visible only after initialized is set to true
Defines
madExcept - code in madExcept processing set by the IDE
}
interface
uses Windows, sysUtils, madExcept;
type
TstoreStuff = procedure (abortOccured: boolean = false) of object;
Tdisplay = procedure (msg: string) of object;
dbxException = class(exception);
dbxExceptionProblem = class(dbxException); // user probably goofed
dbxExceptionData = class(dbxException); // dbx may be corrupted
dbxExceptionIndex = class(dbxExceptionData);
dbxExceptionWarning = class(dbxExceptionData);

{$ifdef madExcept}
procedure exceptionEvent (frozen : boolean;
exceptObject : TObject;
exceptAddr : pointer;
crashedThreadId : dword;
var bugReport : string;
var screenShot : string;
var canContinue : boolean;
var handled : boolean);
(*procedure exceptionAction ( frozen : boolean;
exceptObject : TObject;
exceptAddr : pointer;
bugReport : string;
action : TExceptAction;
var handled : boolean );
*)
procedure exceptionAction (action : TExceptAction;
frozen : boolean;
exceptObject : TObject;
exceptAddr : pointer;
crashedThreadId : dword;
var bugReport : string;
var screenShot : string;
var handled : boolean );
{$endif}

procedure setUpError(aInitialized: boolean=true; aProgKey: string = ''; aEMailVn: string=''; aeLicenseVn: string = '');
var
errorMethod: integer;
initialized: boolean;
storeStuff: TstoreStuff;
display: TDisplay;

implementation
uses
forms, // for application
util;

var
progKey: string;
emailVn: string;
eLicenseVn: string;

{$ifdef madExcept}
var exceptionInProgress: boolean;
saveIdle: TIdleEvent;

procedure msgbox(msg: string);
begin
// application.MessageBox (pchar(msg),pchar(application.title));
util.msg(msg);
end;

procedure exceptionEvent ( frozen : boolean;
exceptObject : TObject;
exceptAddr : pointer;
crashedThreadId : dword;
var bugReport : string;
var screenShot : string;
var canContinue : boolean;
var handled : boolean);
const IEKey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer';
IEName = 'Version';
OEKey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Outlook Express\Version Info';
OEName = 'Current';

var l: integer;
s: string;
msg: string;
begin
msg:=Exception(exceptObject).Message;
if exceptionInProgress then
handled:=true
else
if exceptObject is dbxExceptionProblem then
begin
handled:=true;
msgBox( 'A problem happened in working with an Outlook® Express database. The most likely cause is a selection you made.' + crlf + crlf + msg);
end
else if (exceptObject is dbxExceptionData) or (exceptObject is dbxExceptionIndex) then
begin
handled:=true;
msgbox(pchar('A problem happened in working with the selected Outlook® Express folder. The most likely cause is some kind of problem with the database file that contains the folder.' + crlf + crlf +
'It is strongly recommended that you:' + crlf + crlf +
'1) Close Outlook Express immediately and do not allow any messages to be received until you have further information.' + crlf +
'2) Use Help | Support Forum to get the latest suggestions on dealing with this problem. Search on "corrupt".' + crlf + crlf + msg));
end
else if assigned(uErrors.display) and ((uErrors.errorMethod = 2) or (exceptObject is TWarning)) then
begin
handled:=true;
uErrors.display(msg);
end
else if uErrors.errorMethod = 1 then
begin
handled:=true;
msgBox(Exception(exceptObject).Message);
end
else
begin
exceptionInProgress:=true;
saveIdle:=application.OnIdle;
application.OnIdle:=nil;
madExcept.PauseFreezeCheck();
l:=pos(crlf+crlf,bugReport);
s:=crlf+'Main capption : ' + stringReplace(application.MainForm.Caption, ' ', ' ',[rfReplaceAll]) +
crlf+'Outlook Express : ' + util.getRegistry(OEKey,OEName,'Unavailable') +
crlf+'Internet Explorer : ' + util.getRegistry(IEKey,IEName,'Unavailable') +
crlf+'E-mail address : ' + util.getRegistry(progKey,eMailVn,'Unavailable') +
crlf+'Progam key : ' + util.getRegistry(progKey,eLicenseVn,'Unavailable');
insert(s,bugReport,l);
canContinue:=initialized;
end;
end;

(*procedure exceptionAction ( frozen : boolean;
exceptObject : TObject;
exceptAddr : pointer;
bugReport : string;
action : TExceptAction;
var handled : boolean );

*)
procedure exceptionAction (action : TExceptAction;
frozen : boolean;
exceptObject : TObject;
exceptAddr : pointer;
crashedThreadId : dword;
var bugReport : string;
var screenShot : string;
var handled : boolean );

var res: boolean;
begin
if ((action=eaRestartApplication) or (action=eaCloseApplication)) and initialized then
begin
if assigned(uErrors.storeStuff) then
begin
res:=util.ask('Would you like to attempt to save the program options, customizations, etc?',nil,'','','',false);
if res then uErrors.storeStuff(true);
end;
end
else if (action=eaContinueApplication) then
begin
exceptionInProgress:=false;
madExcept.PauseFreezeCheck(false);
application.OnIdle:= saveIdle;
end;
end;
{$endif}

procedure setUpError(aInitialized: boolean=true; aProgKey: string = ''; aEMailVn: string=''; aeLicenseVn: string = '');
begin
initialized:=aInitialized;
if aProgKey<>'' then uErrors.progKey:=aProgkey;
if aEMailVn<>'' then uErrors.eMailVn:=aEMailVn;
if aeLicenseVn<>'' then uErrors.eLicenseVn:=aeLicenseVn;
end;

initialization
uErrors.errorMethod:=0;
uErrors.initialized:=false;
uErrors.progKey:='';
uErrors.eMailVn:='';
uErrors.eLicenseVn:='';
uErrors.storeStuff:=nil;
uErrors.display:=nil;
end.

The main program has the following:

{$ifdef madExcept}
var eH: TExceptEvent;
eHA: TExceptActionEvent;
{$endif}
begin
Application.Initialize;
util.title:='Start Up';
{$ifdef madExcept}
madExcept.TitleBar:=oe.progName + ' Problem Dialog';
madExcept.MailAddr:=progBugAddress;
eH:=uErrors.exceptionEvent;
madExcept.RegisterExceptionHandler(eh,true);
eHA:=uErrors.exceptionAction;
madExcept.RegisterExceptActionHandler(eHA,true);
{$endif}

The strange way of passing the event handlers works fine with the old way and helps me trap when you next change the calling sequences.

Back to the last release.
altheeldr
 
Posts: 11
Joined: Tue Apr 20, 2004 9:27 pm

Postby madshi » Wed Apr 21, 2004 12:03 pm

Too bad, your code seems to work for me. Well, I had to change some things, cause I don't have that "Util" unit, but I think the most important stuff is active and everything works just fine for me... :cry:

Did you search for madExcept.* after having uninstalled the madCollection? Did you find some such files?
madshi
Site Admin
 
Posts: 10209
Joined: Sun Mar 21, 2004 5:25 pm

Postby altheeldr » Wed Apr 21, 2004 1:09 pm

Lots of stuff - but all in the trash can:-)

The madCollection installation takes care of making sure delphi can find what is needed, correct?

What is madexcept.dbx???
altheeldr
 
Posts: 11
Joined: Tue Apr 20, 2004 9:27 pm

Postby madshi » Wed Apr 21, 2004 1:12 pm

Yes, the madCollection installation takes care of that. However, it does not delete files which were manually copied to another location, of course.

madExcept.dbx? Sounds like an Outlook file. Do you have an extra directory for madExcept in your Outlook?

When you have your version out, could you please drop me a note? I'd really like to solve this problem. But I need your help and I fear it will cost you a bit of time... :?
madshi
Site Admin
 
Posts: 10209
Joined: Sun Mar 21, 2004 5:25 pm

Postby altheeldr » Wed Apr 21, 2004 1:15 pm

Yep i do have a outlook express folder for your stuff:-)

I'll get back with you when I have time.
altheeldr
 
Posts: 11
Joined: Tue Apr 20, 2004 9:27 pm

Postby madshi » Fri Apr 23, 2004 6:33 pm

I've found a bug and uploaded a new build. It might fix the problem. If you have 5 minutes time for a quick go at it, here's the download:

http://madshi.net/madCollectionBeta.exe (2.1.1.1)
madshi
Site Admin
 
Posts: 10209
Joined: Sun Mar 21, 2004 5:25 pm

Postby altheeldr » Sat Apr 24, 2004 6:47 pm

It worked just fine, thank you. Will this be the production release?

Regards,
Al
altheeldr
 
Posts: 11
Joined: Tue Apr 20, 2004 9:27 pm

Postby madshi » Sat Apr 24, 2004 7:00 pm

altheeldr wrote:It worked just fine, thank you.

Yiipiieh!!! :crazy:

altheeldr wrote:Will this be the production release?

Which version did you download? Version 2.1.1.4 is the latest one (uploaded about an hour ago). That one might be the next production release (but renamed to 2.1.2.0). Or it is at least very near to the production release. I plan to release a new version tomorrow. No major changes until then, only minor tweaks - if at all.
madshi
Site Admin
 
Posts: 10209
Joined: Sun Mar 21, 2004 5:25 pm


Return to madExcept

Who is online

Users browsing this forum: No registered users and 9 guests