July 21, 2011

Simio Development: Using DebugView and Traces for easier debugging

Simio allows to extend their software through their .NET-API.  One important issue is to debug the custom code, whether it's a step, element or add-in. The easiest way is to download the Visual Studio 2010 Express (C#-Version) and use the built-in debugger. All you need to do is attach to the running Simio process (Simio.exe) and set a breakpoint in your code. Works really well.

There is another - maybe easier - way to debug your code, without breakpoints or attaching to the running Simio process. This solution involves DebugView, a tool from the Microsoft Sysinternals-Suite, and the System.Diagnostics.Trace class. DebugView allows to monitor any trace or debug events from running processes. It's a very small application, which needs no installation at all, simply unzip it and start it. Now if you use the TraceWarning(), TraceInformation(), or TraceError() methods from the Trace class to output information from any point in your code you will see this information in DebugView when Simio executes your code. Cool huh?

Show your Simio traces in DebugView

Make sure that you build your assembly in debug-mode to acitivate the traces. If you build in release-mode the traces will be deactivated.

Using DebugView to debug custom Simio code saves you some clicks if you only want to follow what your code is doing. It does not, however, replace a real debug if you have a real bug that you cannot find this way. Then you should attach Visual Studio to the Simio process and use the breakpoints to step into the code.

Although this makes development for Simio easier, the most annoying problem is still there: Everytime you make changes to your code you have to restart Simio in order for your changes to take affect. This slows down the development cycle a great bit, as this happens quite often. At this point I would like to add to the Simio feature wishlist to offer a way to dynamically refresh DLLs in the UserExtensions folder. Please.