Posted by: Jeff Germain | December 16, 2009

Debugging Server Object Extensions

Not sure how I missed this one, but Dave just turned me onto it. Simon, over at Map Butcher, did a great post a while back on how to debug server object extensions in Visual Studio. Check it out here and say good-bye to “debugging” using log files.

So, to roll with this using the post-build event configuration in my previous post, you’ll need to copy over the your SOE’s debug file (.pdb). Do it manually from the bin\debug folder, or add it to the post-build event as follows:

   1: IF EXIST $(SolutionDir)_install_ComUtilities\CDOT.ArcGisServer.SOEs.LrsSOE.dll (

   2:     $(SolutionDir)_install_ComUtilities\regasm /unregister $(SolutionDir)_install_ComUtilities\CDOT.ArcGisServer.SOEs.LrsSOE.dll

   3: )

   4: IF EXIST $(SolutionDir)_install_ComUtilities\CDOT.ArcGisServer.SOEs.LrsSOEInterface.dll (

   5:     $(SolutionDir)_install_ComUtilities\regasm /unregister $(SolutionDir)_install_ComUtilities\CDOT.ArcGisServer.SOEs.LrsSOEInterface.dll

   6: )

   7:  

   8: SC STOP ArcServerObjectManager

   9: ping -n 5 localhost > NUL

  10:  

  11: DEL $(SolutionDir)_install_ComUtilities\*.dll

  12: DEL $(SolutionDir)_install_ComUtilities\*.tlb

  13: DEL $(SolutionDir)_install_ComUtilities\*.pdb

  14: DEL $(SolutionDir)_install_ComUtilities\Logs\*.txt

  15:  

  16: COPY $(TargetDir)*.dll $(SolutionDir)_install_ComUtilities\*.dll

  17: IF $(ConfigurationName)==Debug (

  18:     COPY $(TargetDir)$(TargetName).pdb $(SolutionDir)_install_ComUtilities\$(TargetName).pdb

  19: )

  20: ping -n 2 localhost > NUL

  21: $(SolutionDir)_install_ComUtilities\regasm $(SolutionDir)_install_ComUtilities\CDOT.ArcGisServer.SOEs.LrsSOE.dll /tlb:$(SolutionDir)_install_ComUtilities\CDOT.ArcGisServer.SOEs.LrsSOE.tlb /codebase

  22: $(SolutionDir)_install_ComUtilities\regasm $(SolutionDir)_install_ComUtilities\CDOT.ArcGisServer.SOEs.LrsSOEInterface.dll /tlb:$(SolutionDir)_install_ComUtilities\CDOT.ArcGisServer.SOEs.LrsSOEInterface.tlb /codebase

  23:  

  24: SC START ArcServerObjectManager

What’s new?

Line 1 & 4:  To avoid errors I’ve added a check to unregister DLLs only if they exist.

Line 13:  Delete any debug files from output directory.

Line 17:  If SOE’s build is configured for “Debug”, then copy only the SOE’s debug file to the output directory.

That’s it. Now you’re ready to debug your SOE.

Happy debugging!

Advertisements

Responses

  1. U made quite a few fantastic stuff with ur posting, “Debugging Server Object Extensions jeff
    germains blog”. I may possibly be heading back to ur web page in the near future.

    Thank you -Ulrich

  2. “Debugging Server Object Extensions jeff germains blog” was in fact certainly compelling and beneficial!
    Within modern society that is difficult to do. Thank you,
    Ashley

  3. “Debugging Server Object Extensions jeff germains blog” was in fact a really wonderful blog, .
    Keep writing and I am going to continue to keep reading! Thank you
    -Denise


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: