none
Visual Studio 2015 hangs when adding a controlle in an ASP.Net MVC project

    Question

  • I have a fresh install of VS 2015 Enterprise and started a ASP.Net MVC project. When I try to add a controller (MVC 5  Controller with views, using Entity Framework) to my project, Visual Studio starts scaffolding and then hangs.

    I tried to repair the VS installation, reinstalled the EF-package but it still hangs.

    Any ideas?


    • Edited by Jerma Tuesday, November 10, 2015 9:59 AM
    Tuesday, November 10, 2015 9:57 AM

Answers

  • Hi Jerma,

    Just to make this issue clearly, whether all MVC projects have the same issue? For example, just create a simple MVC app, and then add the controller again, how about the result? Which step generated the "hang" issue? For example, if you add the controller, could you get the window like the following screen shot?

    For the VS crashed or hung issue, it is hard for us to find the solution directly, but we could narrow down this issue one step by one step.

    (1) Restart your machine, and then re-open your VS, test it again.

    (2) Please run your VS in safe mode, so we could make sure that whether it is related to the add-ins.

    https://msdn.microsoft.com/en-us/library/ms241278.aspx?f=255&MSPPError=-2147217396

    (3) Please close all third party processes in your windows and make sure that the task manager is free.

    (4) Please also run your VS as the admin.

    (5)Please also make sure that your project was saved to your local drive like this thread:

    http://stackoverflow.com/questions/21990954/visual-studio-2012-freezes-while-adding-a-new-asp-net-mvc-controller

    But if just the specific solution has this issue, maybe we would think about the solution files.

    Reference:

    http://digioz.blogspot.com/2013/06/visual-studio-2012-freezes-or-crashes.html

    It is about the VS2012, but you could also troubleshoot this issue in your side using the VS2015.

    Please also make sure that you don't use certain source control tool which maybe impact the VS performance.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 11, 2015 9:03 AM
    Moderator

All replies

  • Hi Jerma,

    Just to make this issue clearly, whether all MVC projects have the same issue? For example, just create a simple MVC app, and then add the controller again, how about the result? Which step generated the "hang" issue? For example, if you add the controller, could you get the window like the following screen shot?

    For the VS crashed or hung issue, it is hard for us to find the solution directly, but we could narrow down this issue one step by one step.

    (1) Restart your machine, and then re-open your VS, test it again.

    (2) Please run your VS in safe mode, so we could make sure that whether it is related to the add-ins.

    https://msdn.microsoft.com/en-us/library/ms241278.aspx?f=255&MSPPError=-2147217396

    (3) Please close all third party processes in your windows and make sure that the task manager is free.

    (4) Please also run your VS as the admin.

    (5)Please also make sure that your project was saved to your local drive like this thread:

    http://stackoverflow.com/questions/21990954/visual-studio-2012-freezes-while-adding-a-new-asp-net-mvc-controller

    But if just the specific solution has this issue, maybe we would think about the solution files.

    Reference:

    http://digioz.blogspot.com/2013/06/visual-studio-2012-freezes-or-crashes.html

    It is about the VS2012, but you could also troubleshoot this issue in your side using the VS2015.

    Please also make sure that you don't use certain source control tool which maybe impact the VS performance.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 11, 2015 9:03 AM
    Moderator
  • I get this problem too.  I see the same workaround discussed below and that doesn't work for me or many others around the web. I can see what's going on in Task Manager.  In my case, Visual Studio 2013 starts consuming more and more RAM after I pick "Add new controller..." from the menu.  It eventually consumes enough memory that an OutOfMemory exception occurs.  Most people will detect VS as unresponsive and close long before OutOfMemory exception occurs.  From others' descriptions, I'm fairly confident majority of people are also experiencing this problem related to consuming too much RAM.

    After spending an hour or two reading other posts on the web, a couple things seem very clear.  1) This occurs in large projects that have many files, not small sample projects.  2)  It appears it may only affect projects that also contain web forms, or possibly were converted to the newer ASP.NET project type that supports both WebForms and MVC.

    After I pick a controller template, VS must be executing code that succeeds in small projects, but uses too much RAM on very large projects.  I'm using VS 2013 and am presented with scaffolding options after choosing "Add file / Controller".  I pick the empty controller template, but next window *never appears* (Add Controller window below) while VS consumes RAM indefinitely until crashing.

    I've also tried all listed workarounds, including starting VS in safe mode.  Does that rule out extensions or just add-ons? 

    • Edited by Luke Ferris Monday, September 19, 2016 9:32 PM
    Monday, September 19, 2016 8:25 PM