locked
Custom controls cannot be displayed RRS feed

  • Question

  • Hi,

    Recently the designer in my project refuses to load for all but a base custom user control that is shared between many custom controls. The entire project builds and run without errors. Here is a link to the ActivityLog.xml (https://www.dropbox.com/s/nrdkqjcl1zozvl2/ActivityLog.xml?dl=0) that was generated. It appears to be related to "Microsoft Data Transformation Services Designer" but I am unsure of how to fix the issue.

    Any help is greatly appreciated.

    I followed the answer given at https://stackoverflow.com/questions/36010177/error-when-previewing-mvc-views-in-visual-studio-2015 and now the control partially loads. That is, the control will load a custom control that inherits from the aforementioned base custom control, but nothing specific to this new custom control.

    Now, when the program runs, the control appears as it does in the designer (this is, empty). However, when I check the CustomControl.Designer.cs file, all of the automatically generated code is there like it should be, but it does not appear in the designer or when the application is run.
    Wednesday, January 31, 2018 9:39 PM

All replies

  • Hi Ricky890710,

    Welcome to the MSDN forum.

    Have you been installing any extension or windows patches lately?

    You could start VS in safe mode (devenv /SafeMode), which could prevent all third-party VSPackages from loading when Visual Studio starts, thus ensuring stable execution. If it works fine in safe mode, that means the installed extensions may be corrupted the VS, please go to Tool—Extensions and Updates… and remove all installed extensions one by one to find the culprit.

    According to the error message “CreateInstance failed for package [Microsoft Data Transformation Services Designer] Source”, please have a try with delete or rename the following folders:

    • C:\Users\<your users name>\AppData\Local\Microsoft\VisualStudio\14.0
    • C:\Users\<your users name>\AppData\Roaming\Microsoft\VisualStudio\14.0

    If it still doesn’t work, you could try to repair Visual Studio 2015.

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, February 1, 2018 6:49 AM
  • Hi Judy,

    So, I'm having this issue on two different computers. I reinstalled Visual Studio on both over night.

    On one, the error went away but the controls still do not show up (The Designer.cs file is still there with the auto generated code that shows there should be something there. I have compared it to an older file and everything seems to be in place minus a few changes. Maybe I'm missing something?) and when I run the application the controls do not show up either now.

    On the second computer, the designer still refuses to show up, but the application builds with everything appearing as it should.

    I have tried deleting both folders on both computers to no avail.

    The original error I was attempting to fix was this:

    "The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: {fileName} --- The base class '{baseClassName}' could not be loaded. Ensure the assembly has been referenced and that all projects have been built."

    The base class is in the same assembly and all projects have been built. Now, when I go to the baseClass, I get a similar error that references its base class. However, whenever I go to this base class, the designer loads and everything is as expected.

    EDIT: I fixed the first computer's problem. It seems that the code actually generating the control (rather than just all of the controls on the control) was deleted somehow in my quest to fix the crash. However, my issue in fixing the second computer where the Designer crashes still stands.
    • Edited by Ricky890710 Thursday, February 1, 2018 3:32 PM
    Thursday, February 1, 2018 2:50 PM
  • Hi Ricky890710,

    Glad your fixed your problem in the first computer.

    Do you have the same configuration on both computers? Are they opened the same solution?

    Could please create a totally new project in second computer, execute a simple test to see if the Designer still crashes?

    If it works fine, that might be caused by the specific solution.

    Otherwise, it could be caused by the VS on the second computer. Have you been installing any extension or windows patches lately in the second computer?

    I suggest that you could uninstall the visual studio using the forcibly uninstall command: like "vs_community.exe /uninstall /force" in the elevated command prompt, for more detail information, please see here:https://blogs.msdn.microsoft.com/heaths/2015/07/17/removing-visual-studio-components-left-behind-after-an-uninstall/. After this, rebooting your machine and reinstalling Visual Studio 2015.

    In addition, you could copy the solution from first computer to the second computer, open it with Visual Studio, check the results?

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, February 2, 2018 7:50 AM
  • Hi Judy,

    The only difference between the two is that the first computer is using Windows 7 and the second computer is using Windows 10. They are both using the same solution (with the Windows 7 computer being built for x86 and the Windows 10 computer being built for x64 because of some changes in a few third party DLLs).

    What kind of test did you have in mind for me to do?

    I have not installed any extensions or updates on either computer.

    I will attempt to forcibly uninstall Visual Studio as you have suggested and I will report back my results.

    That is basically what I did to get the solution ported over to Windows 10. Granted, I had to change a few build settings (from x86 to x64, as mentioned above) but I did not have to change any designer related components.

    Friday, February 2, 2018 4:41 PM
  • Judy,

    I have done the force uninstall, but the error still persists.

    Friday, February 2, 2018 6:40 PM
  • Sorry to spam, but I just attempted to create a new base control (a UserControl with just a label) and then created a new control that inherits from this. The Designer crashes with the same message.
    Friday, February 2, 2018 8:32 PM
  • Hi Ricky890710,

    As far as I know, the interface (XAML) is not inherited, if the UserControl inherits from another UserControl.

    Please have a look at following document might be helpful for you.

    https://support.microsoft.com/en-sg/help/967050/cannot-display-inherited-form-in-form-designer-when-base-form-defined

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, February 5, 2018 5:35 AM
  • Hi Judy,

    I have tried the suggestion to change the project to build with AnyCPU and the Designer still crashes.

    Monday, February 5, 2018 2:41 PM
  • Hi Ricky890710,

    I create a WPF User Control Library project (a UserControl with just a label) use Visual Studio Enterprise 2015 on Windows 10 Enterprise. And create a WPF Application project, add the WPF User Control Library project references.

    My two projects in the same solution, when I build and run the WPF Application project, it works fine.

    Is your project a WPF project?

    Do you meet any error message when you build your solution? If yes, please share it to me.

    Usually, when you use the user control in other project, after you build the project, the UserControl.dll will add to “..\bin\Debug” path. Please make sure your project could get the user control correctly. If not, you could manually copy the UserControl.dll to the “..\bin\Debug” path, then, check the result.

    In addition, if above could not help you, please share the sample solution to me, that will be helpful to test the issue and find the solution.

    About sharing via OneDrive, please refer to: https://onedrive.live.com/

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 6, 2018 7:01 AM
  • Hi Judy,

    My project is a WinForms project, not a WPF project. All classes are located in the same project and I do not get any build errors. My project builds fine and runs normally.

    Here (https://www.dropbox.com/s/9pdkoinugmuv6w1/DesignerCrashTest.zip?dl=0) is a minimal project that reproduces the problem.

    Tuesday, February 6, 2018 9:41 PM
  • Hi Ricky89710,

    I download your project and open it use Visual Studio 2015 on my Windows 10 machine.

    I can open the designer page normal after doing following steps, you could refer to it.

    1. Close all the UI design pages.
    2. Right click the solution in Solution Explorer and click Clean Solution.
    3. Right click the solution in Solution Explorer and click Rebuild Solution.
    4. Open the UI design pages.

     

    Reference link: https://stackoverflow.com/questions/6683255/the-designer-could-not-be-shown-for-this-file-because-none-of-the-classes-within

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 7, 2018 2:29 AM
  • Hi Judy,

    Change the build from AnyCPU to x64 and try those steps. It should still crash.

    Wednesday, February 7, 2018 2:52 PM
  • Hi Ricky890710,

    Yes, I can repro your issue in my side with X64 Platform. But it works fine with X86 and Any CPU platform.

    Following content explains this phenomenon:

    Thanks for your understanding.

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, February 8, 2018 6:28 AM
  • Hi Judy,

    Changing everything to x86 seems to have fixed the issue. Thanks for all your help!

    • Proposed as answer by Judy ZhuY Tuesday, February 13, 2018 1:55 AM
    • Unproposed as answer by Judy ZhuY Wednesday, February 14, 2018 1:50 AM
    • Proposed as answer by Judy ZhuY Wednesday, February 14, 2018 1:50 AM
    Monday, February 12, 2018 2:45 PM
  • Hi Ricky890710,

    Glad you have resolved your issue and share the solution here.

    You could mark your reply as an answer, this will be helpful for other community members who has the similar issue with you.

    Thanks for your understanding.

    Regards,

    Judyzh


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, February 13, 2018 1:55 AM