Visual studio 2010 crashes when switching to designer view - visual-studio-2010

Every time I switch from the code view into designer view Visual studio 2010 crashes and restarts by itself.But before it crashes it displays this error:
"Type universe cannot resolve assembly: System.Windows.
Controls, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35."
Thank you for your help!

Here's a solution.
There says, when you remove the reference which cannot be resolved (in your case System.Windows.Controls), it doesn't crash again. After you delete it you can add the reference again, I think.
To delete the reference, open solution explorer which usually at the right at the VS, find references folder, right click and then remove it.
Hope it works for you.

Related

VS Solution Explorer Analyzers exclamation: ef1000 "possible sql injection vulnerability"

Strange message in Solution Explorer.
ef1000 "possible sql injection vulnerability"
It doesn't prevent compile, no errors, no warnings, no messages in "Errors List".
No similar messages in the output on compile...
Click doesn't move focus to "vulnerability" line. No referenced file/line related information.
But there is context menu with "Delete" button which doesn't work (nothing happens). There are no Analyzers related entries in proj file.
Looks like common package references bug. How to fix it?
I went to that location C:\Users\User.nuget .. etc and deleted the package. I closed visual studio and reopened it. The package was restored and the error was gone. I was using a .net framework application in visual studio at the same time and was opening and closing the core solution repeatedly so I'm thinking the package got corrupted somehow.
Just unload the project and reload it again, the warning is disappeared.
The source
UPDATE for Visual Studio 2019:
If you use Visual Studio 2019 you have always to get last version. So if there are any updates available just install it.
Click on Help => Check for Updates => Update.

Error viewing datatable in vs 2013

When i try to view a dataset or datatable in vs2013 i get this error.
CustomerExceptionDataHolder cannot be cast to CustomExceptionDataHolder.
I just changed from 2010 to 2013 and this started happening. does anyone know why?
...why I got the error, not why I changed.
I just had this exact same issue... I tracked it down to one of the assemblies I referenced from a project in my solution, which referenced Microsoft.VisualStudio.DebuggerVisualizers.dll v 10.0.0.0. As this was one of my own assemblies that I had cross-purposed as a debugger visualizer for VS2010, I went back and removed all that code and the reference, and voila VS2013 visualizers work again.
Use Process Explorer .dll view and you will see what is loaded and when into devenv.exe, this may help you see which assembly is the culprit. Also, ILSpy or equivalent would show you references a .dll makes.

Creating Visual Studio AddIn run error

This has been happening to me over and over for every single AddIn project I make.
I create the AddIn projet from the template wizard and work on it, coding and debugging for a few hours and then all of a sudden I get:
Error 1 Unable to copy file "obj\Debug\Project1.dll" to "bin\Project1.dll". The process cannot access the file 'bin\Project1.dll' because it is being used by another process.
Does anyone know what is this about?
Happening in VS2008 and VS2010.
Thank you
*Edit: I have found a workaround by closing all instances of VS, deleting the Project1.dll file, selecting NO when VS asks me if I want to delete a reference to the AddIn when opening VS instance again.
I actually came across this today and it took me forever to figure it out. For me I was creating an Addin that automatically loaded when Visual Studio starts. The way I fixed it was by going to:
Tools -> Add-in Manager
Then uncheck the first checkbox near your addin. Keep the "Startup" checkbox checked to continue having debugging of your Addin.
Hope this helps.

Error loading DefaultTemplate.xaml in designer

I can't load my projects' DefaultTemplate.xaml file in the designer. (using VS2010 premium, recently reinstalled)
When loading the DefaultTemplate.xaml from the build templates in TFS, I get an error saying that the activity cannot be loaded.
There are errors loading the namespaces. Somehow it cannot find the assemblies needed for TFS.
In the errors list I get about 50 complaints about these namespaces.
I've poked around in it, but never commited any changes. I've tried restoring the original version, but that didn't work.
I've tried replacing the template with the DefaultTemplate.xaml from another project, but I got the same error. I'm at a loss here. How can I fix my VS2010 or template so I can edit it again using the designer?
I can open other projects' DefaultTemplate.xaml files in the designer without any problems.
I suspect that it has to do with some setting in VS2010 or my project somehow not having the right references, but I can't figure out what's wrong or how to solve it.
Hope this or this will address your issue.
Edit:
If above doesn't work try below, you may get more descriptive error by using this. This works for windows applications on VS2008. I've never tried this with VS2010. You can debug your devenv.exe instance by another devenv.exe. Below are the steps. Give it a go...
1) Start a second instance of visual studio
2) go the the Tools menu, "Attach to process", select the 'devenv.exe' process, and click the 'attach' button.
3) In the Debug/Exceptions menu Turn on exception catching when first thrown (in the Debug->Exceptions menu).
4) Open the designer with the debugger attached
5) The second visual studion will break on your error.

Why would my Visual Studio 2008 close everytime I open a .xaml file?

Visual Studio 2008 has been very stable for months on my computer.
This morning when I double-click on any .xaml file to open it, or even click on the tab of an already opened .xaml file, Visual Studio says "initializing toolbar" in the status bar and then 20 seconds later fully closes the whole application without any error message.
Other files (e.g. .cs class files) I can open fine.
Has anyone experience this or know what I could check/change to be able to use Visual Studio to edit .xaml files again?
MORE INFO: I can also create a new project and create and edit .xaml files fine.
MORE INFO: I can edit .xaml files in other modules (projects) fine.
MORE INFO: Everytime it crashes, this event is registered:
.NET Runtime version 2.0.50727.3053 - Fatal Error in executable module (72555E00) (80131506).
(odd since I have .NET framework 3.5 installed)
MORE INFO: It is only in one module (project) that .xaml files cause Visual Studio to crash. Even creating a new UserControl in that module crashes Visual Studio.
I get this occasionally (with .xaml and .resx files) and find that if I delete the solutions .suo file things work fine again.
[The suo file just contains per user settings like recently opened files etc so it's nothing important and will just be recreated when you next open the solution.]
I've been getting the same issue whenever I try to access project settings for a C# project.
Found additional information about this:
Here: http://blog.fryhard.com/archive/2008/11/26/visual-studio-2008-closes-at-build-outlook-2007-add-in.aspx
And here: http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/99e124d0-c5d7-49c0-b1dd-71328f9a6571/
Apparently it's a bug in the core CLR engine that causes the entire CLR to crash if certain types of assemblies are loaded in a certain order.
Most of the time it appears to be directly related to the Visual Studio add-in called PowerCommands - uninstalling PowerCommands will make the problem go away.
And (we hope) it's supposed to be fixed for .Net 4.
This sounds very similar to the issue I had when I first installed VS 2008. Unfortunately, after hours of research, I ended up reinstalling the IDE (with my fingers crossed). No problems since then, but it's obviously not the most enjoyable way to solve the problem.
What is likely happening here is that one of the controls referenced directly on indirectly in your designer is stack overflowing during the designer process. Because the designer is hosted in process a stack overflow by one of the components will take down the designer and VS.
Try attaching a debugger to VS, break on first chance StackOverflow Exceptions and open the designer.

Resources