AV when accessing UserSession
Re: AV when accessing UserSession
..... update please
Re: AV when accessing UserSession
Still working on madCodeHook <sigh>. But should get to this soon.
Re: AV when accessing UserSession
This is now 6 weeks.....
Will it ever be fixed?
Will it ever be fixed?
Re: AV when accessing UserSession
It's been unlucky timing, me busy with urgent madCodeHook support requests.
Anyway, your issue is almost at the top of my list now, I might actually get to it tomorrow.
Anyway, your issue is almost at the top of my list now, I might actually get to it tomorrow.
Re: AV when accessing UserSession
Ok, the solution is pretty simple:
1) Copy madIWSupport.pas/dfm and mad.inc into your project folder, and remove the write protection flag.
2) Comment out the line "handled := AApplication <> nil".
Done. It seems that in earlier IW versions the last parameter to "TIWServerControllerBase.DoException" was "var handled: boolean". And now in the latest version instead it seems to be something like "httpRequest: THttpRequest".
If the IW guys want to offer an official exception callback, basically all I need is a way to hook/overwrite TIWServerControllerBase.DoException. You can send them madIWSupport.pas, that should make it pretty easy for them to see what they could to help me get rid of the nasty hack. Or just send them the whole test project you attached to this thread here, together with madIWSupport.pas/dfm + mad.inc. Then they can test it all with the madExcept non-commercial edition. They could then just send me an updated madIWSupport.pas/dfm file which would work with their new exception callback logic.
1) Copy madIWSupport.pas/dfm and mad.inc into your project folder, and remove the write protection flag.
2) Comment out the line "handled := AApplication <> nil".
Done. It seems that in earlier IW versions the last parameter to "TIWServerControllerBase.DoException" was "var handled: boolean". And now in the latest version instead it seems to be something like "httpRequest: THttpRequest".
If the IW guys want to offer an official exception callback, basically all I need is a way to hook/overwrite TIWServerControllerBase.DoException. You can send them madIWSupport.pas, that should make it pretty easy for them to see what they could to help me get rid of the nasty hack. Or just send them the whole test project you attached to this thread here, together with madIWSupport.pas/dfm + mad.inc. Then they can test it all with the madExcept non-commercial edition. They could then just send me an updated madIWSupport.pas/dfm file which would work with their new exception callback logic.
Re: AV when accessing UserSession
Sorry but this did not fix it.
I completed the tasks you advised. Did a rebuild. Did not fix it.
I deleted all madIWSupport.dcu on my system.
Renamed all madIWSupport.pas/dfm exceptthe one in my project dir.
Did a rebuild. Still did not fix it.
I completed the tasks you advised. Did a rebuild. Did not fix it.
I deleted all madIWSupport.dcu on my system.
Renamed all madIWSupport.pas/dfm exceptthe one in my project dir.
Did a rebuild. Still did not fix it.
Re: AV when accessing UserSession
Can you set a breakpoint in madIWSupport.pas. Does it reach the line before the commented out line?
(Not sure what to say, it definitely fixed it for me.)
(Not sure what to say, it definitely fixed it for me.)
Re: AV when accessing UserSession
I did try but it did not get to the break point.
Re: AV when accessing UserSession
Hmmmm... Do any breakpoints work at all in madIWSupport.pas? You may have to edit the options in mad.inc to make breakpoints work. It needs to be "{$D+}{$L+}".
FWIW, I've tested with Tokyo 10.2 and the latest IW version.
FWIW, I've tested with Tokyo 10.2 and the latest IW version.
Re: AV when accessing UserSession
It was very early (my time) when I last responded.
I set "{$D+}{$L+}" to get breakpoints working...
At not time in my testing did I get an error at the line "// handled := AApplication <> nil;" when it is commented or not commented.
The problem occurs when accessing UserSession in the procedure AddCommandLineHeaderInfo. Evaluating UserSession returns "Access violation at 017086FF accessing 000000A4".
In the procedure AddCommandLineHeaderInfo UserSession is correctly exposed and I can accessed all variables and objects
I set "{$D+}{$L+}" to get breakpoints working...
At not time in my testing did I get an error at the line "// handled := AApplication <> nil;" when it is commented or not commented.
The problem occurs when accessing UserSession in the procedure AddCommandLineHeaderInfo. Evaluating UserSession returns "Access violation at 017086FF accessing 000000A4".
In the procedure AddCommandLineHeaderInfo UserSession is correctly exposed and I can accessed all variables and objects
Re: AV when accessing UserSession
Hmmmm... And this is with the test project you attached here? Or with your real project? To make sure we test the same thing: Which exact Delphi version are you using, and 32bit or 64bit compilation? And I assume you're using the latest IW version?
Re: AV when accessing UserSession
This is with a real project.
Delphi XE
Latest version of IW
Delphi XE
Latest version of IW
Re: AV when accessing UserSession
Could you please double check with the test project you attached to this thread? That's the best way to ensure we're testing the same thing. Thanks.
Re: AV when accessing UserSession
Same with the app I sent you.
In the TIWServerControllerBaseDoExceptionCallbackNew function execution gets to "HandleException(etNormal, AException, nil, true, Esp, Ebp, nil, esIntraweb, AApplication, 0, @bugReport);" then traces into "AddCommandLineHeaderInfo".
When it gets to the the line "exceptIntf.BugReportHeader['User #'] := UserSession.gv_UID;" of "AddCommandLineHeaderInfo".
Never get to process the line " exceptIntf.BugReportHeader['Site ID'] := UserSession.gv_SID;"
Does not output "User #" line to bugreport.txt
Also, after processing "HandleException(etNormal, AException, nil, true, Esp, Ebp, nil, esIntraweb, AApplication, 0, @bugReport);" the variable bugReport is always empty
In the TIWServerControllerBaseDoExceptionCallbackNew function execution gets to "HandleException(etNormal, AException, nil, true, Esp, Ebp, nil, esIntraweb, AApplication, 0, @bugReport);" then traces into "AddCommandLineHeaderInfo".
When it gets to the the line "exceptIntf.BugReportHeader['User #'] := UserSession.gv_UID;" of "AddCommandLineHeaderInfo".
Never get to process the line " exceptIntf.BugReportHeader['Site ID'] := UserSession.gv_SID;"
Does not output "User #" line to bugreport.txt
Also, after processing "HandleException(etNormal, AException, nil, true, Esp, Ebp, nil, esIntraweb, AApplication, 0, @bugReport);" the variable bugReport is always empty
Re: AV when accessing UserSession
Interestingly, I wasn't able to reproduce this in Delphi Tokyo 10.2, but I *am* able to reproduce it in Delphi XE. I'm not sure where the difference is coming from.
When the crash occurs, in your ServerController.pas it seems "WebApplication" is nil. So "WebApplication.Data" crashes, of course. So please change the function "UserSession" to:
Of course then in UserSessionInit.pas you also need to change the code like this:
I've no idea why WebApplication is nil in this situation. But I'm not an IntraWeb expert, so maybe you know.
When the crash occurs, in your ServerController.pas it seems "WebApplication" is nil. So "WebApplication.Data" crashes, of course. So please change the function "UserSession" to:
Code: Select all
function UserSession: TIWUserSession;
begin
if WebApplication <> nil then
Result := TIWUserSession(WebApplication.Data)
else
Result := nil;
end;
Code: Select all
procedure AddCommandLineHeaderInfo(const exceptIntf: IMEException; var handled: boolean);
begin
exceptIntf.BugReportHeader['Product'] := 'Test';
if UserSession <> nil then
begin
exceptIntf.BugReportHeader['User #'] := UserSession.gv_UID;
exceptIntf.BugReportHeader['Site ID'] := UserSession.gv_SID;
end;
end;