Bug report file and folder

delphi package - automated exception handling
FCS
Posts: 15
Joined: Sun May 11, 2014 5:32 pm

Bug report file and folder

Post by FCS »

Hello,

How and where set the folder for saving bug reports. Is it possible to add date/time to the file report name?
When I click on the save report button and fill wizard's fields I only hear a ding sound, and I don't know where the report is saved.

I use BDS2006 and current version of your components.

Regards
Michal
Last edited by FCS on Thu Jul 09, 2015 3:53 pm, edited 1 time in total.
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Bug report file and folder

Post by madshi »

If the user presses the "save bug report" button, there should be a "save as" dialog box appearing which allows the user to choose the file name and path. Does that not happen?

What is it exactly that you want? Do you want this dialog to appear or not? Are we talking only about the situation when the user presses the "save bug report" button or about other situations, as well? Or do you want to define the bug report file path at runtime yourself, instead of asking the user?
FCS
Posts: 15
Joined: Sun May 11, 2014 5:32 pm

Re: Bug report file and folder

Post by FCS »

Hello,

The "save as" dialog box is not displayed, I only hear a windows ding. Looks like a bug.

I want to:

1. Show the save dialog, to give the user the possibility to save the report somewhere.

2. I want to make a zip file containing the report and screen shot and save it in <application path>\error\ folder. In this case the save dialog should not be displayed.

In the application only one choice will be used.

Regards
Michal
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Bug report file and folder

Post by madshi »

Can you reproduce the problem in a simple test project?
FCS
Posts: 15
Joined: Sun May 11, 2014 5:32 pm

Re: Bug report file and folder

Post by FCS »

Hello,

At this moment no.

I'm sending you the mes file.

Regards
Michal
Attachments
Osrodek_mes.zip
(2.63 KiB) Downloaded 291 times
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Bug report file and folder

Post by madshi »

Can you reproduce the problem if you create a simple test project and then use this MES file? If not, the MES file won't help.

One thing you could do is copy madExcept.pas and mad.inc into your project folder. Then search for "GetSaveFileName" in madExcept.pas, set a breakpoint and debug.

Wish I could be more helpful, but as long as I can't reproduce the problem on my PC, there's not so much I can do...
FCS
Posts: 15
Joined: Sun May 11, 2014 5:32 pm

Re: Bug report file and folder

Post by FCS »

Hello,

Code: Select all

begin
  result := false;
  if bugReport = '' then
    exit;
  if bugReportFile = '' then begin
    us1 := settings.BugReportFile;
    if not noDialog then begin
      if IsProcessBlocked(250) then begin
        MessageBeep(0);           -------->> here is the ding
        exit;
      end;
I use madExcept in the DLL project.

Next question.

Where is stored the template for mes files ?
I tried to recreate the mes file for this program but I still saw my changed version.


The e-mail notification does not work on this forum.

Regards
Michal
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Bug report file and folder

Post by madshi »

Is the crash happening in DllMain? There are certain situations where showing the "save as" file dialog would freeze the whole process. madExcept tries to detect that situation and then simply beeps instead of trying to show the dialog. This is usually inside of DllMain.

The mes file is usually stored in the same folder as your dpr file. Not sure what you mean with template. Do you mean the default settings? They're stored in the registry (HKCU\Software\madshi\madExcept, or something like that).

Email notification works for me. Not sure why it doesn't work for you. Maybe the mails get lost on the way somewhere... :?
FCS
Posts: 15
Joined: Sun May 11, 2014 5:32 pm

Re: Bug report file and folder

Post by FCS »

Hello,

Ad. 1.
Yes, the crash is happen in DLL module.

For testing behaviour of your product I prepare this code.

Code: Select all

/---------------------------------------------------------------------------
procedure TFOSR_Menu.Button2Click(Sender: TObject);
var
  dd:double;
begin
  dd:=0;
  MsgBox('test 123/0: '+RealToStr(128.11/dd,2), mfOK);
exit;

end;
The TFOSR_Menu is the main menu in this DLL.

I understand that the save box will show if the crash will happen outside the main menu unit ?

Ad. 2

I know that mes files is created in the folder with the project dpr file.
I thought that the problem happened because I changed by your wizards the original (after first installation) definition of mes file (I localize it, modify dialogs for sending by e-mail and save to the file).

Finally I understand that the template is stored in the registry (HKCU\Software\madshi\madExcept. And if I delete this key, the definition of mes files will be back to your defaults ?


Ad. 3.
OK

Ad. 4.

I asked you too for this behaviour:

I want to make a zip file containing the report and screen shot and save it in <application path>\error\ folder.
In this case the save dialog should not be displayed.

How to define the path to the <application path>\error\ folder ?
Each user may have different localization of the application.

I can make the zip file myself, but I have to know how store bugreport.txt and screenshot.png files in the <application path>\error\ folder.

Regards
Michal
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Bug report file and folder

Post by madshi »

FCS wrote:Yes, the crash is happen in DLL module.
But is it inside of DllMain or outside of DllMain?
FCS wrote:I understand that the save box will show if the crash will happen outside the main menu unit ?
It's got nothing to do with main menu unit or not. The key question is if the crash occurred in a thread which was running inside of DllMain or not. DllMain is practically calling your unit "initialization" and "finalization" sections and the "begin..end" main block in your dll's dpr file. So does the crash occur during initialization/finalization of your DLL? Or does it happen in a function which is exported by your dll and which your exe called?
FCS wrote:I know that mes files is created in the folder with the project dpr file.
I thought that the problem happened because I changed by your wizards the original (after first installation) definition of mes file (I localize it, modify dialogs for sending by e-mail and save to the file).

Finally I understand that the template is stored in the registry (HKCU\Software\madshi\madExcept. And if I delete this key, the definition of mes files will be back to your defaults ?
Translation will not make any problems. If you made other changes to the settings I don't know, there's a small chance they could have to do with this problem, although I think it's unlikely. But you could try restoring to default settings by simply deleting the "yourProject.mes" file. After that reload your project in the IDE. Then, if you haven't change the default settings, too, madExcept should not be active for your project, anymore. Reactivate it, and you should be back to default settings.
FCS wrote:I asked you too for this behaviour:

I want to make a zip file containing the report and screen shot and save it in <application path>\error\ folder.
In this case the save dialog should not be displayed.

How to define the path to the <application path>\error\ folder ?
Each user may have different localization of the application.

I can make the zip file myself, but I have to know how store bugreport.txt and screenshot.png files in the <application path>\error\ folder.
You can change these settings at runtime by doing "MESettings().BugReportZip := bla". See documentation here, and there are more similar settings for the screenshot etc:

http://help.madshi.net/MESettings.htm#I ... gReportZip

Is that what you need?
FCS
Posts: 15
Joined: Sun May 11, 2014 5:32 pm

Re: Bug report file and folder

Post by FCS »

Hello,

I have a small osr.exe application which loads osrodek.dll and calls functions from this DLL. The exe is only luncher for functions from DLL.

The DLL stores the application. Here is the main menu etc.
On the main menu form I have a button raising the test exception (divide by 0).

And here is the problem with saving box, but sending by e-mail works fine.

Finally I want only to store the report and screen shot in the <application path>\error\ folder to the file name with name <date>_<time>.zip.

In the DLL.dpr I added in main begin..end

begin
ShowMessage(ExtractFilePath(Application.ExeName));

MESettings().BugReportFile := ExtractFilePath(Application.ExeName)+'err\osr_rap.txt';

MESettings().BugReportZip := ExtractFilePath(Application.ExeName)+'err\osr_rap.zip';
MESettings().ScreenShotSendAs :='osr_scr.png';
MESettings().ScreenShotZip := ExtractFilePath(Application.ExeName)+'err\osr_scr.zip';
end.

Only the first command seems to be working. Three next doesn't.

I have the next problem. Now the screenshot file is not created in the project folder, but is included to the e-mail.

Edit:
I'm sending you the sample project by e-mail

Regards
Michal
FCS
Posts: 15
Joined: Sun May 11, 2014 5:32 pm

Re: Bug report file and folder

Post by FCS »

Hello,

Did you receive my e-mail with the sample application ?

Regards
Michal
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Bug report file and folder

Post by madshi »

Yes. The problem seems to be that Delphi calls System.@Halt0 in the moment when the DLL's DPR file reaches the final "end.". madExcept has a hook set in @Halt0 and normally if @Halt0 is called that means that the EXE or DLL is already in the process of being shutdown/unloaded. So in that situation I try to avoid doing "dangerous" things. It seems that DLLs call @Halt0 twice: Once at the end of the DPR's "end." and another time when the DLL is actually unloaded. So I've changed my code now to make sure the first call it @Halt0 is ignored. I believe this should fix the issue.

Here's a test build:

http://madshi.net/madCollectionBeta.exe (installer 2.7.11.4)
FCS
Posts: 15
Joined: Sun May 11, 2014 5:32 pm

Re: Bug report file and folder

Post by FCS »

Hello,

Thanks,

I use shortstrings in my applications. Does it make any difference ?


Could you implement in my sample project storing report and screen shot to the err folder, and if it possible compress them to the zip file with the name like:

<date>_<time>.zip

for example: .\err\2015-07-14_170000.zip

Regards
Michal
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Re: Bug report file and folder

Post by madshi »

Can we please look at one problem at a time? Is the problem with the save dialog gone with the test build?
Post Reply