How to show Send bug report dialog

delphi package - automated exception handling
Post Reply
kknyazev
Posts: 8
Joined: Fri Dec 15, 2017 7:03 am

How to show Send bug report dialog

Post by kknyazev »

Hi! I'm trying to skip displaying Full dialog box and show Send assistant dialog, my code in custom exception wich is registered with RegisterExceptionHandler:

Code: Select all

procedure MyExceptionHandler( const exceptIntf : IMEException; var handled: boolean);
begin
...
        exceptIntf.ShowSetting := ssAssistant;
        exceptIntf.ShowAssistant := MESettings.SendAssistant;
//        exceptIntf.SendBugReport(MainForm.Handle);//   := ssAssistant;
        exceptIntf.Show
        Handled := True;
...
end;
And this code works not as default behavior, it creates email but with plain text without attachamnets of bugreport.txt and screenshort.
How can i modify my code to get standard email?
Best regards!
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: How to show Send bug report dialog

Post by madshi »

Try removing "exceptIntf.Show" and "Handled := True". Does that help?
kknyazev
Posts: 8
Joined: Fri Dec 15, 2017 7:03 am

Re: How to show Send bug report dialog

Post by kknyazev »

Code: Select all

        exceptIntf.ShowSetting := ssAssistant;
        exceptIntf.ShowAssistant := MESettings.SendAssistant;
        Handled := False;
No mail created at all, even text
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: How to show Send bug report dialog

Post by madshi »

Sorry, try using "exceptIntf.SendBugReport()" + "handled := true".
kknyazev
Posts: 8
Joined: Fri Dec 15, 2017 7:03 am

Re: How to show Send bug report dialog

Post by kknyazev »

No success, mail created, but with text only
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: How to show Send bug report dialog

Post by madshi »

If you comment out the whole exception handler, and the user then presses the "send bug report" button, do you then get the attachment and the screenshot?
kknyazev
Posts: 8
Joined: Fri Dec 15, 2017 7:03 am

Re: How to show Send bug report dialog

Post by kknyazev »

Yes, it is showed normally.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: How to show Send bug report dialog

Post by madshi »

I've just tried this and it works just fine for me. Instead of using "MainForm.Handle" try using "GetDesktopWindow", just as a test. Also, in the madExcept "attachments settings" did you activate the option "capture out application only"? If so, does unchecking that option change anything?
kknyazev
Posts: 8
Joined: Fri Dec 15, 2017 7:03 am

Re: How to show Send bug report dialog

Post by kknyazev »

Assistant dialog was not showed and mail was not created.
Now i register handler so:

Code: Select all

    DontHookThreads;
    RegisterExceptionHandler( AppExceptionHandler, stTrySyncCallAlways);

and process so:

  handled := True;
  try
    if MainForm <> nil then
      exceptIntf.BugReportSections.Add( 'Last SQL command info', MainForm.LastSqlCmdInfo);

    E := exceptIntf.ExceptObject as Exception;

    if IsQueryCancel(E) then Exit;

    for i := 0 to Screen.FormCount - 1 do
      if (Screen.Forms[i] is TErrorForm) and (TErrorForm(Screen.Forms[i]).ErrorMemo.text = E.Message) then
        exit;

    case TErrorForm.Exec(E) of
      mrOk: Handled := False;
      mrYes: begin
        exceptIntf.ShowSetting := ssAssistant;
        exceptIntf.ShowBugReport(GetDesktopWindow);
        Handled := True;
      end;
    end;

    if Assigned(MainForm)  then
      if IndexText( Trim(E.Message), [
           'Connection is not connected',
           'TCP Provider: An existing connection was forcibly closed by the remote host.']
         ) <> -1
      then
        MainForm.NotifyDisconnect;
  except
    handled := False;
  end;
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: How to show Send bug report dialog

Post by madshi »

I've tried:

Code: Select all

procedure AppExceptionHandler(const exceptIntf: IMEException; var handled: boolean);
begin
  exceptIntf.SendBugReport(GetDesktopWindow);
  Handled := true;
end;

RegisterExceptionHandler(AppExceptionHandler, stDoneSync, epMainPhase);
And this works just fine for me. Can you please double check?

Also, in the madExcept "attachments settings" did you activate the option "capture out application only"? If so, does unchecking that option change anything?
kknyazev
Posts: 8
Joined: Fri Dec 15, 2017 7:03 am

Re: How to show Send bug report dialog

Post by kknyazev »

Ok. I have big complex project and i will recheck on simple project. "capture out application only" is switched off
P.S. Or may be you can you send me working project for test?
Best regards
kknyazev
Posts: 8
Joined: Fri Dec 15, 2017 7:03 am

Re: How to show Send bug report dialog

Post by kknyazev »

The difference is in RegisterExceptionHandler - you use stDontSync, but i can't use it, a need VCL access. Try to change stDontSync to stTrySyncCallAlways in your test project.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: How to show Send bug report dialog

Post by madshi »

You've reported an issue but I can't reproduce it. I'm absolutely willing to help you, but if I'm not able to reproduce the problem, it's hard for me. So the best solution might be for you to create a little test project with which I could reproduce the issue on my PC. Then I can analyze why it's not working.
kknyazev
Posts: 8
Joined: Fri Dec 15, 2017 7:03 am

Re: How to show Send bug report dialog

Post by kknyazev »

Sorry, has you set stTrySyncCallAlways in handler registration?
Post Reply