AmiBroker features a system of detecting and reporting bugs called "Crash recovery system". The name suggests that AmiBroker is now able to recover from such unexpected situations and indeed it can!.
How could this be done? Well... some tricks are needed to wrap the exception handling mechanism used by Windows :-)
Normally when Windows application performs some illegal memory access, illegal operation (for example division by zero) or illegal instruction the system pops the dead-end message box saying "This program has performed an illegal operation and will be shut down". Now you have got no choice - the application is terminated when you click on OK button.
AmiBroker's crash recovery system introduced in v3.47 beta intercepts the exception generated by Windows and instead of standard dead-end message box it displays the following dialog:

As you can see there is a window that displays important system information and there are three buttons Continue, Bug report, Copy to clip, Troubleshoot, Exit program. Clicking on the Exit program button works exactly the same as clicking on "OK" button in the standard Windows dead-end message box. But the first two buttons give you brand new possibilities. If you click on Continue button AmiBroker will try to recover from the error and continue running. In most cases you will be able to save your work and modifications you have made so you will not lose anything. In fact you will be able to work normally. There are however some cases when recovery will not succeed and AmiBroker may be unstable, so it is advised just to save your data and exit. It may also happen that this window will pop up for a couple of times - then you should just click on Continue several times.
The recover function is quite nice but the main purpose of this system is to find and fix the problems in future version and this is why the most important function was provided - Bug report. If you the crash recovery window popped up on your screen please click on Bug report button before attempting to continue work. This will automatically launch your default mail program and prepare the new e-mail with the following information:
To: bugs@amibroker.com
Subject: Bug Report (automatically generated by AmiBroker)
Steps needed to reproduce the bug:
>>PLEASE ENTER THE DESCRIPTION HERE<<
AmiBroker version 4.40.3
( cooltool.dll 4.40.3, mfc42.dll 6.0.8665, msvcrt.dll 7.0.2600 )
Microsoft Windows XP version 5.1 (Build 2600)
Service Pack 1.0
Common Controls: 6.0
Unhandled exception
Type: CSysException
Code: c0000005
Description: ACCESS VIOLATION
Address: 42af1e
Line 1, Column 16:
ROC(Close,Null);
--------------^
(occurred during AFL formula execution)
AFL Parser status:
Processing stage: EXECUTE
Formula ID: 0 ()
Action 3 (SCAN)
Additional information:
Number of stock loaded: 9331
Currently selected stock: WTEL
Number of quotes (current stock): 155
Workspace:
Data source = QP2 , Data local mode = 2, NumBars = 5000
Preferences:
Data source = (local), Data local mode = 1, NumBars = 1000
Command history:
2828 - Shows Analyser - a tool to test systems & explore market--Auto-Analyser
Cache manager stats:
Number of list elements: 2
Number of map elements: 2
Hash table size: 5987
Memory status:
MemoryLoad: 52 %
TotalPhys: 523760K AvailPhys: 246560K
TotalPageFile: 1281044K AvailPageFile: 1050008K
TotalVirtual: 2097024K AvailVirtual: 1950604K
Last Windows message:
HWnd: 0x20eac
Msg: 0x0110
wParam: 0x00030ed6
lParam: 0x00000000
As you can see AmiBroker generates itself most important details for the bug report including even some history of menu selections (Command history) but the most essential thing at this point is to provide the description of steps needed to reproduce the bug. You should just type (in place marked by >>PLEASE ENTER THE DESCRIPTION HERE<<) what you have done before the bug occurred, what special conditions must be met to reproduce it, maybe an AFL formula that you have tried and anything that you suppose might be important (even though AmiBroker includes a few lines of offending formula automatically). This is critical since automatically generated information is very nice but can not cover all the details. Then, when the bug report is complete just click Send in your mail program to send the report to me (note that address and subject fields are filled in for you).
Clicking Copy to clip button allows you to copy above report to the clipboard. You may use this button if automatic send does not work with your default e-mail program.
Clicking Troubleshoot brings up Troubleshooting page at http://www.amibroker.com/troubleshoot.html that contains descriptions of most common problems and how to solve them.
Some final notes: I have put significant amount of work in making this system reliable, however you should be aware that not all exception and/or system errors could be handled by this system and it may happen that AmiBroker will not be able to recover from some fatal error. It is also possible that this system would not be able to intercept all low level exceptions. In that case just prepare the report by yourself giving me as much details as possible.
Please remember that the final goal is making AmiBroker rock-solid and bug-free. This is what I am working on constantly.