Profile Picture

How to debug a compiled DLL plugin in VS Studio

Posted By jamesluong 7 Years Ago
Message
Posted Friday January 29 2010
Hello, I'm new to the forums, rightedge, and .NET development, but learning.

My question is how do I debug in Visual Studio a compiled DLL plugin which I made in Visual Studio (VS).

I took from the forums the source code of a paperbroker plugin and modified it with my own slippage assumptions. In Visual Studio I compile the plugin into a DLL and copied it into the \Plugins directory.

However, when I mark a breakpoint in the source code and run the simulation, it doesn't stop at the breakpoint. This is after I attached VS to the RE process.

Attaching VS to the RE process seems to allow me to debug using VS with uncompiled indicators / strategies, but it doesn't work with this compiled DLL.

How do I use VS to debug the plugin i just made?
Posted Saturday January 30 2010
Hi,

I don't know what's soo special about using VS studio debugger for strategy development, to me, it's just too overkill. MessageBox works well for this simple dev (at least for me).

In case you don't know how to use MessageBox,

1. Add reference to "System.Windows.Forms"
2. Add "using System.Windows.Forms" in your source code.
3. Use it like this "MessageBox.Show("Tada! " + 1 + 2 + 3 + 4 + 5);


You are good to go!
Posted Saturday January 30 2010
Felix,

Thanks for the quick reply. This is actually for a trade execution plugin which is compiled into a DLL. So, it's not actually a readable code file which I can add the message box method to....

James
Posted Saturday January 30 2010
Are you using debug build (as in there's *.pdb files generated) and have you tried using System.Diagnostics.Debugger.Break() ? See if that helps.
Posted Saturday January 30 2010
There are several debugging threads linked from the FAQ post. They mostly deal with debugging trading systems, which it seems like you already have working, but they might still be helpful.

Attaching VS to the RE process seems to allow me to debug using VS with uncompiled indicators / strategies, but it doesn't work with this compiled DLL.


Actually RightEdge compiles your strategy into a DLL before running it, so in both situations you are working with a compiled DLL.

Once you have attached to the RightEdge process, what do the breakpoints in your code look like? Normally there will be a filled brownish/reddish circle to the left of the line with the breakpoint. If this is the case after you've attached to the process, then the breakpoint is working, and if it doesn't stop there it's most likely because that code is never being run. The circle may also turn into a hollow circle with a small exclamation mark by it. This means that the breakpoint won't be hit, probably because the DLL hasn't been loaded, or because Visual Studio doesn't have the debugging information for the DLL.

To get more information, open the Modules window (Debug->Windows->Modules). This will list each DLL loaded in the process, where it was loaded from, and whether debugging symbols were loaded for that process (which is what enables you to debug in VS).

Hopefully this will help you get the debugging working. Let us know if you need further help.

Thanks,
Daniel


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems