Using Microsoft Visual Studio 2013 Express to debug custom tasks

1

It's true: you can use the Microsoft Visual Studio Express tools to build custom tasks for SAS Enterprise Guide and the SAS Add-In for Microsoft Office. And I said as much in my book, Custom Tasks for SAS Enterprise Guide Using Microsoft .NET. I even provided step-by-step instructions for how to get started with your first custom task.

The advantage of the Express editions is that they are free. You can download them from Microsoft's developer site and use them free-and-clear for 30 days. After 30 days, you must "sign in" to the tool with a Microsoft account, but the account is free too.

In my book, I also provided a stern caution about using the Express editions. While you could use the Express tools to build a .NET code library (DLL file) -- necessary for a custom task -- you had very few options for debugging it. The integrated debugger in the Express edition did not allow you to debug into an external application -- anything that you didn't build in the tool. Nor did the debugger offer the option to Attach To Process, which would have allowed you to start SAS Enterprise Guide, get your task loaded in, and then attach a debugging session to hit your breakpoints. And believe me, you will need the debugger.

With Microsoft Visual Studio Express 2013 the debugger integration has improved. You still can't "launch" an external application, but you can attach the debugger to an external process. And that's good enough to get the job done for custom task developers. (And remember -- even though my book didn't mention it -- you can use Visual Studio 2013 to build custom tasks for SAS Enterprise Guide 4.3 and later.)

To use Microsoft Visual Studio Express 2013 to debug your custom task:

Before you begin, make sure the PDB file (debug symbols file) is copied to the same directory as your custom task DLL. This will allow the debugger to sync up and find breakpoints.

With your task DLL in place (in one of the designated Custom folders where SAS Enterprise Guide searches), start SAS Enterprise Guide.

Then, with your task project open in Visual Studio, select Debug->Attach to Process.

In the Attach to Process window, find and select SEGuide.exe. (If you're working with the SAS Add-In for Microsoft Office, then the process you want will be Excel.exe, Winword.exe, or Powerpnt.exe.)

If you have breakpoints set in the debugger, you should find that they are hit (assuming that your task is working properly at that point). You should be able to view the contents of local and class variables in a Watch window. You can set debug options to "break on exception" to find tricky issues. In my book, I dedicate an entire chapter to debugging techniques that work especially well with custom tasks.

Obtaining the Express edition of Visual Studio

Here are some general steps to download the Express edition. I didn't provide exact links as I find those are subject to change, but this general navigation should get you there.

  • Visit VisualStudio.com, and select Downloads.
  • Look for the "Express" section; that's where you'll find the Express downloads. (Microsoft also offers trial periods for the professional editions -- if you want to give those a go.)
  • There are a few different flavors: one for Web, one for Windows 8, and one for Desktop.
    The specific version you want is Microsoft Visual Studio Express 2013 for Windows Desktop.

I still recommend the professional edition of Microsoft Visual Studio, especially if you're planning to build multiple custom tasks and maintain them over the long haul. Use the Express edition to experiment and dabble, and to explore whether custom tasks are a viable solution for your business problems. But if you continue with custom tasks, invest in the professional version. The professional editions provide even better debugging features, plus many productivity features that you'll appreciate, such as refactoring techniques, integrated profiling, unit testing, and more.

See also

SAS custom tasks: using Microsoft Visual Studio 2013 and other new toys
11 super-useful custom tasks for SAS Enterprise Guide
Custom tasks for SAS Enterprise Guide: Q&A

Share

About Author

Chris Hemedinger

Director, SAS User Engagement

+Chris Hemedinger is the Director of SAS User Engagement, which includes our SAS Communities and SAS User Groups. Since 1993, Chris has worked for SAS as an author, a software developer, an R&D manager and a consultant. Inexplicably, Chris is still coasting on the limited fame he earned as an author of SAS For Dummies

Back to Top