Locked How to debug FxCop custom rules?

  • Thursday, September 08, 2005 11:08 PM
     
     
    How to debug FxCop custom rules code?

    Thanks in advance,
    Grace

All Replies

  • Friday, September 09, 2005 3:48 AM
    Moderator
     
     Answered
    To debug custom rules do the following:

    1. Ensure the debug symbols (.pdb) of your rule assembly is located in the same directory as the rule assembly itself
    2. Open your FxCop project that contains your custom rule
    3. Open your custom rules project
    4. In Visual Studio, Choose Debug -> Attach To Process
    5. In the Attach to Process dialog, select FxCop.exe in the Available Processes
    6. Click Attach
    7. In Visual Studio set a breakpoint in the rule you want to debug
    8. In FxCop, click Analyze

    FxCop should break on your breakpoint.

  • Friday, September 09, 2005 5:17 PM
     
     
    Excellent.
     
    My first try did not copy pdb file to FxCop.exe "Rules Directory" thus failed. After copied it, it works.