It's by design. Metatrader shuts down when it detects the debugger.
You'll have to find a way to debug .Net code without debugger. Try log files.
try again with compile x64 bit only
Visual Studio 2019 open project use Class Library (.NET Framework)
and compile change Any CPU to x64 all project
(debug I install Microsoft Build Tools 2015)

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I have this .NET DLL that I made, called TradingSystem.dll, and I import it into an expert advisor in MT5 running on Windows 10 x64.
The EA code looks like this:
#import "TradingSystem.dll"
void TS_Initialize();
#import
int OnInit()
{
TS_Initialize();
return(INIT_SUCCEEDED);
}
The .NET code:
{
[DllExport("TS_" + nameof(Initialize), CallingConvention.Cdecl)]
public static void Initialize() { ... }
I would like to be able to debug this in .NET. Here's what I tried:
I also tried to start the project with the debugger already attached by configuring the project to start Terminal64.exe on debug. This results in terminal64.exe showing this message: A debugger has been found running in your system. Please unload it from memory and restart your program.
What is the correct way to debug the .NET DLL?