codesamples:exception_handling_program_startup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
codesamples:exception_handling_program_startup [2024/09/16 04:33] – wolfgangriedmann | codesamples:exception_handling_program_startup [2024/09/16 09:06] (current) – wolfgangriedmann | ||
---|---|---|---|
Line 7: | Line 7: | ||
class XStartupCode | class XStartupCode | ||
[STAThreadAttribute]; | [STAThreadAttribute]; | ||
- | static method Start as void | + | static method Start() as void strict |
local oSB as System.Text.StringBuilder | local oSB as System.Text.StringBuilder | ||
try | try | ||
- | Functions.Start() | + | |
catch oEx as Exception | catch oEx as Exception | ||
Line 29: | Line 29: | ||
Output( oSB, " | Output( oSB, " | ||
Output( oSB, "Press Return to close the application" | Output( oSB, "Press Return to close the application" | ||
- | | + | |
MessageBox( 0, oSB: | MessageBox( 0, oSB: | ||
System.IO.File.AppendAllText( System.IO.Path.Combine( AppDomain.CurrentDomain: | System.IO.File.AppendAllText( System.IO.Path.Combine( AppDomain.CurrentDomain: | ||
Line 40: | Line 40: | ||
oSB: | oSB: | ||
Console.WriteLine( cText ) | Console.WriteLine( cText ) | ||
- | |||
- | return | ||
- | |||
- | static method Wait() as void | ||
- | |||
- | Console.ReadLine() | ||
return | return | ||
Line 61: | Line 55: | ||
< | < | ||
Please see here for a sample as XIDE application export file: | Please see here for a sample as XIDE application export file: | ||
- | [[https:// | + | [[https:// |
+ | |||
+ | For a native .NET application with namespaces the code changes a bit: | ||
+ | < | ||
+ | |||
+ | [STAThreadAttribute]; | ||
+ | static method Start as void | ||
+ | local oSB as System.Text.StringBuilder</ | ||
+ | where '' | ||
+ | The compiler option than has to be | ||
+ | < | ||
+ | |||
+ | To explain: since the GUI can be not yet started when an exception is occurring, the console mode needs to be activated so the error can be shown even with no GUI (and written to a file for later evaluation). | ||
codesamples/exception_handling_program_startup.1726461189.txt.gz · Last modified: 2024/09/16 04:33 by wolfgangriedmann