Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot create class diagram for simple dll class in Visual Studio 2010

Tags:

c#

.net

It seems that there is a really annoying issue in Class Diagram designer in VS (my version is 2010 Ultimate, release, but the issue is also observed in VS 2008).

When I'm trying to create a class diagram for particular simple class from DLL I'm getting the following error: "Some of the selected type(s) cannot be added to the class diagram. Check the code for errors and ensure that all required assemblies ... blah-blah-blah". I cannot find the root cause for the issue and I cannot distinguish what characteristics of classes influence on that error (it can actually build a class diagram for some classes, but not for all).

My code doesn't contain any error. I have multiple class and interface definitions in one separate .cs file, but these classes are really simple - even no calls to unmanaged/interop.

Any solution for this?

like image 615
xenn_33 Avatar asked May 08 '10 12:05

xenn_33


1 Answers

Probably it is not root of your problems but check if these classes that won't show in diagrams are not partial and if you don't have any other class defined before this partial class in the same file. For example code like this prevents forms from proper showing in designer in Visual Studio 2010:

class AAA
{
    //this class prevents BBB form from showing in designer
}

partial class BBB : Form
{

}

If you move declaration of AAA after BBB everything is ok, error occurs only in order showed above.

like image 78
grapkulec Avatar answered Oct 02 '22 01:10

grapkulec