When I run a test application in XIDE it shows a black error screen that quickly disappears.
How can I capture that error?
Is it saved somewhere? Is there a setting I've missed?
XIDE Adventure
XIDE Adventure
Joe Curran
Ohio USA
Ohio USA
Re: XIDE Adventure
Hi Joe,
what is your Start() method? And are you talking about a VOGUI Classes application?
Anyway: try to put similar code in your Start() method:
And this is my Error handler:
After an exception you should find a XSharpError.log file in your application folder.
To have code lines in it you have to compile with Debug set to on.
Wolfgang
what is your Start() method? And are you talking about a VOGUI Classes application?
Anyway: try to put similar code in your Start() method:
Code: Select all
[STAThread];
function Start() as void
try
// Ein eigenes APP-Object setzen
oApp := EnhancedApp{}
__SetAppObject( oApp )
oApp:Start()
catch oEx as Exception
VOXSErrorHandler.ProcessException( oEx )
end try
return 0
Code: Select all
static class VOXSErrorHandler
static constructor()
return
static method UnhandledException( Sender as object, e as UnhandledExceptionEventArgs ) as void
VOXSErrorHandler.ProcessException( ( Exception ) e:ExceptionObject )
return
static method ProcessException( oException as Exception ) as void
local cMessage as string
cMessage := oException:Message
VOXSErrorHandler.WriteErrorLog( oException )
do while oException:InnerException != NULL_OBJECT
oException := oException:InnerException
VOXSErrorHandler.WriteErrorLog( oException )
cMessage += CRLF + oException:Message
enddo
VOXSErrorHandler.ErrBox( cMessage )
return
static method WriteErrorLog( oException as Exception ) as void
local cFileName as string
// local cErrorText as string
local oSB as StringBuilder
cFileName := Path.Combine( AppDomain.CurrentDomain:BaseDirectory, "XSharpError.log" )
oSB := StringBuilder{ String.Format( "Error occurred in {0} at {1}", Assembly.GetEntryAssembly():Location, DateTime.Now:ToString() ) }
oSB:AppendLine( "------------------------------------------------------------" )
oSB:AppendLine( oException:Message )
oSB:AppendLine( "Callstack:" )
oSB:AppendLine( oException:StackTrace )
oSB:AppendLine( "" )
File.AppendAllText( cFileName, oSB:ToString() )
return
static method ErrBox( cText as string ) as void
local oParent as object
local oBox as TextBox
oParent := GetObjectByHandle( GetActiveWindow() )
if oParent == null_object
oParent := nil
endif
oBox := TextBox{ oParent, "Error", cText }
oBox:Type := BOXICONHAND
oBox:Beep := true
oBox:Show()
return
end class
To have code lines in it you have to compile with Debug set to on.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Re: XIDE Adventure
Joe,
i'd suspect, your app is a console app and in Xide unter Tools/Preferences/General the setting "Add pause in console applications" is NOT set. Set it, and the screen will stay
i'd suspect, your app is a console app and in Xide unter Tools/Preferences/General the setting "Add pause in console applications" is NOT set. Set it, and the screen will stay
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Re: XIDE Adventure
Thank you both. It is a console app that I'm using to test some basic SQL routines.
Karl: That box is checked.
Wolfgang: I'll try to write an error handler based on the example you provided.
The adventure continues!
Karl: That box is checked.
Wolfgang: I'll try to write an error handler based on the example you provided.
The adventure continues!
Joe Curran
Ohio USA
Ohio USA
Re: XIDE Adventure
Hi Joe,
A cut down sample from Wolfgang's more sophisticated error handler, that will also do the job for simple test apps:
A cut down sample from Wolfgang's more sophisticated error handler, that will also do the job for simple test apps:
Code: Select all
FUNCTION Start() AS VOID
TRY
// do stuff
CATCH e AS Exception
? "Error happened:"
? e:ToString()
END TRY
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu