Search code examples
vb.netvisual-studiovisual-studio-2017

Unable to Attach Debug Visual Studio 2017 with VB .NET got Error Exception of type 'System.ComponentModel.Design.ExceptionCollection' was thrown


I am using Visual Studio 2017 and I am trying to fix an error I got:

The designer loader did not provide a root component but has not indicated why.

And then when I close and re-open I get this error:

Exception of type 'System.ComponentModel.Design.ExceptionCollection' was thrown.

I am trying to follow this answer: System.ComponentModel.Design.ExceptionCollection

  1. I cant find:

In one instance, goto Debug->Exceptions and enable all the 'Thrown' options to stop at first chance exceptions

So I went to Debug>Windows>Exception Settings. But I was not certain what to check since there is no 'Thrown' that seems to make sense. Maybe check everything?

  1. I can't attach to the process it is missing when I tried to do this:

    In the same instance, select Debug->Attach to Process, select devenv.exe. enter image description here

This is what I got when I debugged it with Jimi's suggestions: 1: https://i.sstatic.net/VLyJm.png

The form works fine at run time, it only has an issue at design time.


Solution

  • Here is what I came up with for a solution.

    1. I checked my code into Git to save the design file (you can also manually save in notepad or save the code file for a backup).
    2. I opened the code file and left it open to get past this error: Exception of type 'System.ComponentModel.Design.ExceptionCollection' was thrown.
    3. I double clicked the form (or you can right click on the code to view designer).
    4. I got a new error that I could ignore to skip: The designer loader did not provide a root component but has not indicated why.
    5. I had to then move something on the form so that the form would re-generate designer code. Otherwise the error would keep coming up.
    6. EDIT: I am not sure where to put this, but it should work. I am still trying to fix this, but here is what I have so far. I found a line of code causing issues. So I am going to use this to only run at runtime. Dim designMode As Boolean = (System.ComponentModel.LicenseManager.UsageMode = System.ComponentModel.LicenseUsageMode.Designtime)

    BAM! Fixed :) Thanks for all your help guys!