Skip to content

Debugging Tools

Rowan Miller edited this page Jul 26, 2016 · 1 revision

Setting up the environment

  • Follow steps outlined in the Building the Tools article (essentially run BuildEFTools /t:Install from VS command prompt) - to replace your current EF Tools with the Debug version

  • Open the EFTools.sln in Visual Studio (it will be the debugger)

  • Add the following path to your symbol paths: [ef_git_repo_root]\bin\Debug\en\Symbols (Tools -> Options -> Debugging -> Symbols). Note that these are symbols for the dlls that were installed – they won’t be replaced when you build the code but they will be replaced when you build the installer

  • Open another instance of VS (it will be the debuggee)

  • In the debugger instance of Visual Studio Attach to the debuggee process (Debug -> Attach to Process...)

Once you create a new project or open an existing one and start the designer the designer assemblies will get loaded to the VS process. From this point you should be able to set break points and debug the designer code. To remove the debug version of EFTools just uninstall EFTools from Programs and Features and either repair your Visual Studio or install the latest MSI from the download center.

Tips

  • Changing and building the designer source code is not enough to make your changes visible from Visual Studio – you need to install the version you have built

  • When working on changes we prefer to write unit tests since you can modify the code and test your changes without reinstalling the designer

  • If there are no changes to .vstemplates run your commands with the SkipEnvSetup set to true. It will make the installation process much faster - example:

    BuildEFTools /t:Install /p:SkipEnvSetup=true
    
  • When working on changes you can speed up building the designer code by using msbuild directly instead of the BuildEFTools command. The BuildEFTools runs Code Analysis which takes time

  • In my day to day work I use a macro that combines fast building and installing EFTools described above which invokes the following command:

    msbuild EFTools.msbuild /t:Install /p:SkipEnvSetup=true $*
    
  • Always use BuildEFTools command (without any additional parameters) for check-in validation

  • There are a couple of places in the designer where the debugger breaks due to the first chance exception (most notably an ArgumentException in MicrosoftDataEntityDesignDocData. CreateAndLoadBuffer when you open an edmx file). These are (typically) benign bugs. Press F5 and move on. Feel free to report.

Clone this wiki locally