Jan
14

Debugging custom forms and console tasks in Service Manager

By

When customizing Service Manager you might want to create a custom form for a custom class. You’ll probably end up with some code behind for some fancy stuff interacting with the form. Maybe you want to list data from a remote data source? When dealing with scenarios like this it’s always nice to be able to debug your code. Here are the steps you need to go through to be able to debug a custom form or a custom console task (a task in the ”Task pane”) from within Visual Studio.

  1. In the code behind, add suitable breakpoints.
  2. Make sure that you’ve configured the build procedure to use “Debug” mode by opening the “Configuration Manager…” and choosing the “Debug” option in the “Configuration” drop down.*

    *If you don’t see the “Configuration Manager…” menu item. Enable it by going into “Tools” – “Options”, under “Projects and Solution” – “General” you check the “Show advanced build configurations” and click OK.
  3. Build your debug assembly files by clicking “Build” – “Build Solution” in the menu.
  4. Go to the “Debug” output directory of your project. Copy the assembly file (.dll) and the program debug database file (.pdb) containing your form and debugging information.
  5. Paste the files into the Service Manager install directory (normally “C:\Program Files\Microsoft System Center\Service Manager 2010″) on your Service Manager server.
  6. Open the Service Manager console.
  7. In Visual Studio go to “Tools” – “Attach to Process” and select the process called “Microsoft.EnterpriseManagement.ServiceManager.UI.Console.exe” and click “Attach”.
     
  8. You’re now ready to debug your custom form or task. Open up your custom form or click your custom task within the console and you should hit your break points within Visual Studio.

Comments

  1. [...] from our System Center MVPs, such as blog postings from Patrik Sundqvist and Anders Bengtsson, on their respective community and blog [...]

  2. Dinh Hoang Thuong says:

    How about debug workflows ??
    I can’t do that with my custom workflow :(

  3. Patrik Sundqvist says:

    To debug workflows you simply attach the debugger to the monitoring host which is running under the specified workflow account. Remeber to build your workflow assemblies in debug mode.

    Let’t me know if you’re having problems with this and I’ll write a more detailed post regarding this.

  4. Dinh Hoang Thuong says:

    I did extract what you say, but there isn’t effect
    My custom workflow will catch a new incident when it’s created and write Title to a file. Here are the steps what i did:
    1. Build assembly in debug mode
    2. attach the debugger to the monitoring host. There have two monitoring host in my computer, i choose extract monitoring which is running under the specified workflow account.
    but i my VS can’t debug when I create a new incident and title of new incident was written to file

    Did i miss any thing? Please help me
    Thanks.

  5. Patrik Sundqvist says:

    Hi

    The instructions below can be read at the Service Manager SDK site.

    To install and debug the workflow
    After compiling the workflow, copy the workflow binary to the %programfiles%\Microsoft System Center\Service Manager 2010 folder on the management group servers that will contain the management pack referencing the workflow.

    To debug the workflow, copy the .pdb file together with the .dll into the Service Manager directory.

    To trigger the debugger, insert calls to the Break method into the workflow code.

    When the workflow is initiated and a code line with the break is executed, the standard debugging dialog box appears. (This requires that you have Visual Studio installed on the server.)

    http://msdn.microsoft.com/en-us/library/ff688384.aspx

    I hope that helps!

Leave a Reply