How to debug OWIN related stuff using Symbol Source


I ran into a situation today wherein I was required to debug the Google Authentication middleware built on top of OWIN.

I already had the code checked out from Katana project in CodePlex. However, when I tried to use, it was the latest bits [dev channel]. My app was using the version 2.1 and the dev version was in 3.0.

Tired of searching the tag for the version 2.1, I came to know that the symbols for the various open source projects are made available from SymbolSource.org

Given this piece of information, I read the steps on how to configure the symbol server in Visual studio and then upon successful source registration, I was able to step through the middlewares and do the debugging stuff.

Things that I did were,

  1. Grab the public [authentication less uri access] from Symbol Source [http://srv.symbolsource.org/pdb/Public%5D
  2. Go to Tools -> Options -> Debugger -> General.
  3. Uncheck “Enable Just My Code (Managed only)”.
  4. Uncheck “Enable .NET Framework source stepping”. Yes, it is misleading, but if you don’t, then Visual Studio will ignore your custom server order (see further on) and only use it’s own servers.
  5. Check “Enable source server support”.
  6. Uncheck “Require source files to exactly match the original version”
  7. Go to Tools -> Options -> Debugger -> Symbols.
  8. Select a folder for the local symbol/source cache. You may experience silent failures in getting symbols if it doesn’t exist or is read-only for some reason.
  9. Add symbol servers under “Symbol file (.pdb) locations”. Pay attention to the correct order, because some servers may contain symbols for the same binaries: with or without sources. We recommend the following setup:
    1. http://referencesource.microsoft.com/symbols
    2. http://srv.symbolsource.org/pdb/Public or the authenticated variant (see above)
    3. http://srv.symbolsource.org/pdb/MyGet or the authenticated variant (see above)
    4. http://msdl.microsoft.com/download/symbols
  10. These steps are highlighted in the Uri [http://www.symbolsource.org/Public/Wiki/Using]
This saved me a lot of time than hunting for the specified tagged version and to build them and then use it.
 
Hope this helps

Creating CHM help files using Sandcastle


Its common nature that, every body writes comments in their codes. But, little know that, these comments in your class can help lot if properly done. Means, creating help files automatically from the class like Microsoft styles CHM (Microsoft Compiled HTML file).

 First, write the proper comments in your class, properties

Make sure that, you are writing the comments in a stipulated format (XML style, please referhttp://msdn.microsoft.com/en-us/magazine/cc302121.aspx  )

Some sample comments,

/// <summary>
/// Information about FOP of credit card
/// </summary>

Install the sandcastle 
Download the sandcastle from http://shfb.codeplex.com/releases/view/29710  ) and install it. This will be installed in the “C:\Program Files\Sandcastle”. Please make sure the installed folder contains “Examples\generic” as this folder contains the GUI form of the sandcastle interface. You can also, use the command prompt commands to create the CHM file.

Creating Comments XML 
You need to pass the comments written in C# in XML format. This can be done by using Doc property of the C# compiler.

  • Go to the command prompt from Visual studio command prompt
  • Run this below command

 C:\Program Files\Microsoft Visual Studio 9.0\VC>csc /t:library /recurse: D:\WORKS\Classes\*.cs  /doc:comments.xml

  • /T:Library  – to create a library after compilation
  • /recurse:<Folder Path of c#> will take all the C# classes from the root and also, sub folders
  • /doc : Comments.xml   — The file name of where all the comments will be stored (name can be your choice)

This will create “Comments.XML” and also, the DLL file which comprises of entire class included.

You can also use the DLL which you compiled from your VS 2005 / 2008 and use only the Comments.xml.

Please make sure all the properties which are exposed as PUBLIC are having XML comments, otherwise, the compiler will throw compilation error.

Creating CHM Files
Go to the folder where you installed the sandcastle (C:\Program Files\Sandcastle) and go to Examples\generic in the same folder.

You will find an exe named “SandcastleGui.exe” and execute it

In the assemblies, tab, click the add button and select the Dll file

  • In the comments, tab, add the Comments.XML
  • In the text box, give a proper name for your CHM file
  • Click the Build button
  • Now, it will open up a window and ask for *.SCProj type, browse to  “C:\Program Files\Sandcastle\Examples\generic” and select the test.scproj
  • Asking for overwrite, say yes.
  • The build will start and create a folder called in the “C:\Program Files\Sandcastle\Examples “ folder
  • Open up the folder you may see “VS2005” and CHM folder

Double click the CHM and see the details…

Taken from: http://social.technet.microsoft.com/wiki/contents/articles/creating-chm-help-files-using-sandcastle.aspx