Class Designer & Project References Error

When a Solution contains many projects and a projects contains reference to another project in same solution, then if I try to open Class Designer File, its throws error which says "Cannot Load '[Class Designer File Path]' Object reference not set to an instance of an object; but if I remove all project reference from that project, class designer files open normally, but then project won't compile. I reinstall Visual Studio, even reinstall windows, but nothing works. What should I do?

[507 byte] By [AnwarJaved] at [2007-12-23]
# 1

That sounds pretty bad - what kind of projects are you using? I.e. are they class libraries/web/whatever and which languages are the projects? What is the kind of the project which contains the diagram file?

Regards
/Dmitriy

Dmitriy.Vasyura at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 2
All projects are class libraries and in C#.
AnwarJaved at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 3

Ok, that means we'll need to do more work to localize the problem. Let me ask you some questions:

1) If you add a new diagram in the same project save, close and reopen it - does it work?

2) What happens if you add some types on the new diagram, then save close and reopen it?

3) If 2 works, then what happens if you add types from referenced projects, save, close and reopen?

4) Did the diagram in question worked at all at some point? If so, do you recall what kind of changes were made to the environment/code after that?

Sorry for asking this many - this appears like a serious problem and we'd be interested to understand the reason so we can fix it for further versions and find a work-around for the current if possible.

Regards
/Dmitriy

Dmitriy.Vasyura at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 4

1) I try to add new class diagram to project but it throw error and display a messagebox "Cannot load '[New Class Designer File Path]'; Invalid Xpath Query: /dotnet[@Path = '[Path to dll of referenced project]'], but new class diagram file is now exists in project, but i can't open it & same above error occurs.

2) I cannot added new types to new class diagram as i can't open it until i remove project reference.

3) I can't add types from referenced project as described above. even if try to drag type from other project (with all project references removed), it says "Some of the selected types cannot be added to class diagram. check the code for error and ensure that all required assemblies are referenced".

4) class desigram works fine if no project reference is added to project.

All My projects build output set to "bin directory", not to debug or release. is this a problem?

AnwarJaved at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 5

I find some solution.

I copy the project to another folder than Default project folder "My Documents\Visual Studio 2005\Projects\" and I opened it and Its' working fine now. but the same project is not working in the default project folder "My Documents\Visual Studio 2005\Projects". I don't know what the problem with Default project folder because i have Full security permission to my documents folder. Is it some security problem?

AnwarJaved at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 6

Anwar,

First of all, thanks a lot for the detailed description - I will try to reproduce the problem here with the data you have provided.

The work-around hints me to ask you another question - is your documents folder located on a network share by any chance?

Regards
/Dmitriy

Dmitriy.Vasyura at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 7
No, My documents folder is not on network share, its on another drive "E: Drive" and the Path to My documents Folder is "E:\DOCUMENTS\Anwar's Documents\My Documents"
AnwarJaved at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 8

Anwar,

I think the problem is caused by the default document folder. The single quote is the reason.

Could you please try to use another location (directory) without single quote to build you project and see if the error still exits?

We already know this issue and appropriate people are working on this.

YuXiao at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 9
Okay, this is pretty old, but this is the only place I can find that even mentions this problem, and I have it as well. Any fix yet? I don't see why there should be problems with spaces in file names...
SireeBob at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 10

I experience exactly the same problem, exept that I don't have single quotes in my path. Insteed, I think in my case, it's caused by Vista.

Any hints on what to do?

/Anders

AndersBratland at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 11

Anders,

I have same problem in my Vista PC. But I try to move my work folder to other and the new path didn't have single quotes, then the problem is solved.

So please try this..

J2.NETe at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...
# 12

I had the same problem with a multi-projects solution.

I am using a French version of Windows XP so the default document folder didn't contained a single quote character. The case here was that one of the projects folder contained a single quote in its name.

Just make sure that no folders along the path of any of your references contains a single quote character and you should be okay.

Jean-FrancoisRene at 2007-8-31 > top of Msdn Tech,Visual Studio,Visual Studio Class Designer...

Visual Studio

Site Classified