Problem running MT4 in debugger

 
Hi,

I'm working on an expert that utilizes a DLL I'm making. In debugging the DLL, it is sometimes necessary to run MetaTrader inside a debugger, so as to catch exceptions in the DLL. I have done this before in past without problems. However, now, I find I cannot run MetaTrader in my debugger (MS Visual Studio 2005). When I try to run it, I get this:

Unhandled exception at 0x00ba7586 in terminal.exe: 0xC0000005: Access violation writing location 0x00400fff.

I do not get this exception running MetaTrader on its own - only in a debugger.

MetaTrader has downloaded a live update since the last time I was able to do this successfully, and I'm wondering if you have changed anything that would have caused this exception.

Please let me know if there is anything I can do to remedy this, as otherwise it will be very difficult to debug my DLL.

Regards,
Kevin
 
I thought I'd add that this crash of MetaTrader occurrs in the debugger even if I do not have my expert or DLL loaded. Therefore this is obviously a MetaTrader issue and nothing in my DLL or expert - I've even removed them entirely and it still happens. It crashes right upon starting MetaTrader (before it opens any windows).

The new build that just downloaded (not surprisingly) changed the address of the crash. It's now:

Unhandled exception at 0x00ba85a4 in terminal.exe: 0xC0000005: Access violation writing location 0x00400fff.

Again, this is making it difficult to debug the DLL I'm writing for my experts.

I'm wondering if anyone else is having this problem. If anyone has Visual Studio 2005, try running MetaTrader in the debugger and see what happens.

I notice that when I run MetaTrader (not in a debugger), there are two instances of terminal.exe running. This makes me think maybe this is being done on purpose. I've seen programs try to prevent being run in a debugger by spawning themselves as a debugger, thereby making the system unable to attach another debugger. I hope this isn't the case. Such mechanisms can be defeated but I don't have two months to pick apart MetaTrader just to be able to debug my own DLL. I don't really see why they would be doing this, because this program doesn't have a dongle or any copy protection anyway.. heck you can download it for free!

This is getting frustrating...

Kevin
 
Ok, I have found that, while I can't start MetaTrader in a debugger, I can attach a debugger afterwards. I just make my DLL put up a message box to give me a chance to attach the debugger. This is better than nothing, but it does mean I can't save breakpoints. Argh. O well.

Oh, and I was mistaken about MT4 using the "ghost debugger" trick to prevent debugging. I thought I saw two instances, but I was apparently just seeing things.

Cheers
Kevin
 

unfortunately i got the same problem !

i can only debug my DLLS with the mt4.00 build 218...

when i update it to version 220 the problem came out

Reason: