Search This Blog

Wednesday, February 7, 2018

No Visual Studio designers for generic ViewController versions

XAF Controllers are technically descendants of the System.ComponentModel.Component class, primarily to be smoothly integrated with the Visual Studio design time features. The standard Component designer does not support generic classes due to a Visual Studio limitation: https://stackoverflow.com/questions/6877217/can-visual-studio-designer-show-classes-inheriting-generic-types 
This is a Microsoft functionality and we cannot do much about it on our side. So, if you have a class like this, and try to double click it or use the Enter key for it in the Solution Explorer, you will receive this error, which is expected here:



This has always caused support calls to us from day one and still causes them today. Check out this support article to learn more about this situation and our previous recommendations.

Starting with v17.2.6, we have removed the visual designer association from the base ViewController<ViewType> and ObjectViewController<ViewType, ObjectType> classes - they will always be opened directly in the Code Editor now. This should work fine in Visual Studio 2015, 2017 and newer versions. This does not work for Visual Studio 2013 and older versions and we decided not to investigate this further, because of the very low usage rate of these IDEs nowadays.



We believe that this new behavior is most expected here and really hope that it will not cause new questions😀. Originally, generic View Controllers were specially designed for users who prefer to do everything manually and want to have a more elegant and compact code. So, opening the Code Editor for such classes is naturally expected. Taking this opportunity, we also improved our online documentation to further promote generic View Controllers, since most of our Support Center answers, demos and docs use this concise code approach anyway.

My team and I are looking forward to hear from you on what you think of the new behavior.

4 comments:

  1. Hi Dennis, we never use the designer for controllers... is it possible to add an advanced option to the installer to not associate the designer at all ?

    ReplyDelete
    Replies
    1. Thanks for sharing your experience, Chris (me too!). Frankly speaking, this does not look like something for what we would be ready to patch our installer... It also appears that it is more natural to accomplish this configuration at your Visual Studio level. For now, I can only advise you not using our item templates and continue writing things in code or using solutions like https://stackoverflow.com/questions/567606/disable-designer-in-visual-studio or rather instruct your IDE once to always open such files using the Code Editor as this guy suggested:
      https://stackoverflow.com/a/2139044/592926

      Delete
  2. Ok, Dennis, thanks for the links.

    ReplyDelete