Search code examples
wpfvisual-studiovisual-studio-2017class-diagram

Unable to open class diagram in designer


Unable to open CustomerClasses.cd in designer

Learning C#, WPF and Visual Studio, in a demo project I have these 2 class diagram files:

  • CustomerClasses.cd - opens in code view only
  • ViewModelClasses.cd - opens in designer view only

Note: files available from here https://github.com/puckchaser/MvvmDemoApp/tree/master/DemoApp/Class%20Diagrams

First challenge was installing the designer feature, see here: Class Diagrams in VS 2017

The right click context menus for both files (via solution explorer) are different. From reading around I gather that a probable reason that CustomerClasses does NOT open in designer view is due to malformed XML, but neither I nor (as far as I can tell) Visual Studio is able to find any issue.

What I see

Image shows CustomerClasses.cd (left) displayed as code and ViewModelClasses.cd (right) displayed as diagram. Menu for CustomerClasses.cd (far right) does not work.


But it is shown in the related article...

I believe that I should be able to see the design view because it is shown in the related article as figure 11: https://msdn.microsoft.com/en-us/magazine/dd419663.aspx?f=255&MSPPError=-2147217396

Related article showing the missing diagram

Furthermore, the xml of the file seems to correspond to what is shown in the diagram... this is driving me nuts


FWIW - this is one of the best walk-throughs I've come across for learning WPF in C#.


Solution

  • Fixed but not sure why

    I downloaded the source files from github (which happens to be a different source than originally used) https://github.com/puckchaser/MvvmDemoApp and tried again, this time it works.

    I used version control to try and identify the root cause of the issue but I don't see anything that explains this to me. There were changes in the file: DemoApp.csproj but I don't know if they could explain this :-/