Visual Studio 2013 crashing when saving Windows Forms solution - winforms

I have been working on a particular solution for a few months now without any problems. The last thing of significance that I remember doing was refactoring the name of a custom control inheriting from RichTextBox. I don't know if that is related to the problem but it seemed to be when the problems started occurring. For some reason now when I show the main form in design view and save any changes I get the message "Visual Studio has stopped working blah blah" and it restarts.
I seem to be able to load and make changes to other solutions ok.
So far I've tried:
Deleting .sln and v12.sln files
Have tried uninstalling NuGet. (I don't have any extensions other than NuGet and Visual Studio Extensions for Windows Library for JavaScript)
I don't have resharper
I have tried to start in /SafeMode but I keep getting the error "'Visual Studio Component Model Host Package' package did not load correctly". I can't seem to load any solutions in SafeMode.
Repaired VS2013 installation twice
Restarted my computer many times
Tried writing a log file using /log switch but can't really understand how to interpret it.
Any pointers would be very welcome.

Related

Visual Studio hangs when adding forms or opening designer

I have a major problem with a Winforms application with a large number of projects. VS 2019 threw an exception and closed a few days ago, and on reopening restored two files since then I have been unable to:
Add a new form to the vast majority of projects, whether the most basic MS template or not
Open the designer for any form that is already in the vast majority of projects
Access the navigation bars (the three combo boxes at the top of the VS work area that normally contain the project, namespace and content information) on any class referencing to WinForms in the vast majority of projects
When trying to do either of the first two things an 'Opening File' message is shown endlessly. If you try to do anything, a notification is shown that Visual Studio is busy, and that Microsoft will be notified but nothing else happens and you can only get out by using the Task Manager to kill all VS tasks.
In the case of the third one, a message is shown saying 'Refreshing Navigation Bars' but again it goes on forever. However, in this case you can click the Cancel button to cancel the loading attempt.
The navigation bars issue I believe is Resharper related. In addition CodeLens is not working at all, so the space for the number of references is generated but there is no content. This is true for ALL files in the solution, not just the form related ones.
Here is what I have tried so far:
Cleaned and Rebuilt the solution - works fine but no difference
Built and deployed the solution - works fine
Deleted the SUO file and reset
Cleared the Resharper caches
Disabled Resharper
Performed a repair install of Visual Studio
Created a new Solution and added forms etc. which was unaffected and worked fine
Opened a different solution which was also working fine
Tried the same processes with a Project in the same solution that is not part of the application (TestBed) and that works fine too, but is the only project that does
Can anyone suggest where to look now? Since new and existing solutions work OK except for this one I am assuming that it is something Solution related rather than something related to VS itself, but I have no idea what that might be. For example, what is it trying to do when it says 'Opening File' (apart from the obvious - opening a file :-)) and what could cause that to fail? Am I looking for something in the Solution file, or could it be something else?
All suggestions and assistance towards resolving this issue would be gratefully received.
Thanks to Jasimov for the only response, I appreciate your attempt to help.
I have now resolved the issue using the following steps:
Uninstall Visual Studio 2019 Community Edition
Perform a fresh install of Visual Studio 2019 Professional
Reload the main solution
Clean the solution
Rebuild the solution
Deal with some issues that were highlighted in the Output and Errors, none of which were directly forms related
Rebuild the solution
Run the application and ensure it runs as expected
Go back and select forms at random and try opening them. All now work as expected.
In addition CodeLens is now working not only properly but actually better than before giving more information more quickly. On the other hand, I have not yet reinstalled Resharper which will be the next step.
I have included all the steps I took just in case anyone else has a similar problem. I have not been able to find this exact issue anywhere else in my searches so I hope it helps someone.
UPDATE: I have since re-installed Resharper with no problems and the designers are all working fine so now back into full flow!
I had a similar issue with the web forms designer in VS2019 hanging as soon as I clicked on anything on the design surface. The same projects were OK in VS2017. Uninstalled VS2019, rebooted, reinstalled VS2019, found that the designer was now working OK. Progressively added back 3rd party toolbox components, one VSIX, and the .Net 4.8 targeting pack. Still working. Thanks for your hint about the reinstall.

'Could not find part of a path' errors in Visual Studio 2013 that don't appear in Visual Studio 2010

I've recently had the misfortune of being upgraded to Visual Studio 2013 at work and it has been nothing short of a nightmare. Ever since upgrading my large scale WPF application to .NET 4.5.1 in Visual Studio 2013, I've been getting mysterious 'fake' errors appearing in the Error List. Sometimes they even stay after a Clean and/or Rebuild, but they not really true errors. Here is an example where you can see that I have just cleaned, but still the errors remain:
I want to be clear here... there is no problem with this view model and I can build that project, or the whole solution without (real) error and the application also runs perfectly:
Furthermore, when running the application there is also a problem that it has with image paths. My images are all displayed perfectly, but I get these 'fake' errors again:
Note that the listed paths are even displayed incorrectly:
C:\Midas;component\Images\Actions\Delete.ico
In the UI, it is referenced like this:
<Image Source="/Midas;component/Images/Actions/Delete.ico" ... />
I'm not really sure whether these fake errors are caused by changes made to Visual Studio 2013, or by changes made to the .NET Framework in versions 4.5, or 4.5.1. I'm hoping someone can shed some light on this for me, because I'm about ready to downgrade to .NET 4.5, just so I can use Visual Studio 2012 instead.
It looks like you're using the /{Assembly};{path/to/Image} construct without the pack:// uri prefix. The editor is warning you that it can't find the file because it doesn't really understand the Uri (until the application is actually built). It'll be defaulting to looking on the file system and trying to prefix it with file://, which of course results in a relative uri to the working directory of the Visual Studio process.
I suspect that if you explicitly include the pack:// uri prefix, that the editor will stop complaining.
pack://application:,,,/Midas;component/Images/Actions/Delete.ico
That way the designer will just know that it should not be trying to look for a file:// location.

Bunch of Could not find schema Information for element statements for xaml file

I'm writing an WPF application in Visual Studio 2010. My project compiles and runs correctly. But because of an unknown reason, from yesterday, the intellisense doesn't work for xaml files. And when a xaml file opens, a bunch of "could not find schema information for elements" statements appear in the error window. Could anyone tell me what causes this problem and how to solve it?
I think there is no way to fix this issue. I had this issue also in the past and after googling I ended up that it is a nown issue in Visual Studio 2010. The problem I also noticed was that in my application (with multiple projects) Visual Studio did not build a part of my projects any more. Only deleting the ouput files helped.
Therefore I switched to Sharp Develop. Until now I dont have any strange issues with XAML or references any more. But maybe also a switch to VS2012 will help.

"The name 'InitializeComponent' does not exist in the current context" - for new WPF projects

I have a similar problem as previously reported (and unanswered successfully/unsolved) as below:
"If I create a new project in Visual Studio 2010 SP1 and select "WPF Application" it generates the application, but I get the error "The name 'InitializeComponent' does not exist in the current context" even before i build it.
I get the same error when I try to build established projects. Yesterday, I had no problems with it.
"
Im pretty sure that this issue is nothing to do with the project, source files or generated settings, but may have to do with a corrupt visual studio installation, registry, .net or windows itself because the same project (exactly the same) builds fine on my coleagues computer and vice-versa does not. Also, i have reinstalled Visual Studio, uninstalled & reinstalled, deleted & reinstalled, install-fixed from the microsoft disks and even tried manually deleting Visual studio/.net/C# and still get the problem. This issue is with both new WPF projects created with the wizard and with existing projects created weeks earlier.
The only option that seems to present itself now seems to be wiping my hard drive and reinstalling windows and Visual Studio again etc.
Any ideas regarding the fault or how best to wipe my system down to a level that will truly eradicate Visual Studio and its registry setting would be gratefully received ?
I had the same problem and eventually discovered (after reinstalling VS and that had no effect) that by removing and re-installing the .Net frameworks the problem went away.
There are two primary causes of this very common and annoying problem!
The most common is the x:Class doesn't match up with the MainPage.xaml namespace. Make sure that x:Class in MainPage.xaml has the correct namespace.
The second most common cause of this problem is that the "Build Action" is not set to "Page" for MainPage.xaml!
This happens with Silverlight or WPF and though it is a PITA when you don't know what caused it once you know what the problem is; it is a simple fix. One of those things we all have to learn the hard way, but thanks for Stack Overflow.
I wrote a blog article that has pictures and explains Initialize Component does not exist in current context problem.

Editing a Form in Visual Studio when TFS is offline

I'm running Visual Studio 2010 and using Team Foundation Server, and this thing is pissing me off no end.
Here's the scenario: since I work from home it often happens to me to work at strange hours or on the week-end, when our TFS is offline. This has never been a problem, since usually I just reload the solution and when VS detects that the TFS is not available it promprts you to work offline.
Now, I usually work on WPF projects, and working offline has never be a problem, even when editing XAML files it works with no issues. But now I have to edit a Form from a Windows Forms project, and VS refuses to collaborate. Whatever I do to the form, VS just does nothing other than playing that obnoxious "bing" sound that usually plays when an error of some kind occours. It doesn't even popup an error dialog box, just does nothing!
Any ideas??
Ok figured it out, I had to remove the "Read Only" attribute from ALL the files in the project (I had tried with the project file and form file, but that isn't enough evidently).

Resources