Accueil > code > Debuging UserControl when the designer crash…

Debuging UserControl when the designer crash…

Do you ever happened to make an UserControl and when you want to use it in the designer, Visual Studio crash? This is what happened recently for a control in the Dungeon Eye project. Even using the debug mode in Visual Studio (devenv.exe / log), no way to find the exact location of the bug. No messages, no reports, only a restart of the application. In the worst case, your settings reopens the bogus file when you reopen your project. Welcome to an endless crash loop !

Debuging using MessageBox.Show() is not very practical, very slow and not really user friendly… So why not use Visual Studio to debug Visual Studio ? Here’s how :

    • Launch Visual Studio in normal mode and open your project.
    • Start another instance of Visual Studio and go to the Debug menu and ‘Attach to process …’

    • Select the first instance of your Visual Studio

  • Click on ‘Attach’

Now, make your UserControl crash and, now you can debug it !

[Photo]

Tags:
  1. Pas encore de commentaire
  1. Pas encore de trackbacks