I have been having serious problems lately with Visual Studio 2010. This was a crash in an unusual way when I came across certain types of XAML errors during the InitializeComponent() of a control / window.
The program is interrupted and the visual studio moves up as if it is catching an exception (because it is), and then it stops in the middle, showing the broken highlight in my XAML file without any details regarding what is wrong. Example:

There are no popups or Anywhere details about what's wrong, just a column pointing to my call to InitializeComponent() .
Now, as a rule, I just did a trial version and corrected the error to solve this problem, and find out where I got corrupted, but the real problem is not in my code. At the moment, Visual Studio is completely useless. It informs my application in the "Run" mode. The Stop / Break / Restart buttons on the toolbar or in the menu do nothing (but gray).
Closing the application does not stop this behavior, closing the visual studio, forcing it to get stuck in a massive loop where it yells at me, complaining that every open file is not in the debugging project, and then repeats this process when I convinced every open file .
I need to force close devenv.exe , and after that it happens 3-4 times in a row a lot of time wasted (since my projects are usually quite large and the studio can be quite slow @ loading).
To the point
- Has anyone else experienced this?
- How to stop the studio from blocking.
- Can I get information from this monster on LEAST in a different way, so that I can correct my XAML error earlier than after 3-4 compilation of trial and error, leading to the same failure?
Any help would be appreciated.
Visual Studio 2010 Version: 10.0.30319.1RTM
Change and update
FWIW, basically the errors causing this are XamlParseExceptions (I figured it out after I discovered what was wrong with my XAML).
I think I need to be clearer, although I am not looking for a solution to my code problem, as these are usually typos / small things, I am looking for a solution for VStudio that all gets distorted as a result.
The specific error in the above image that 100% surely caused this was a XamlParseException caused by forgetting the Value attribute in the data trigger.
I fixed this part, but it still doesn’t tell me why my studio turns into a piece of a castrated program when a completely normal exception occurs in XAML parsing.
Code that will cause this problem (at least for me)
This is a basic WPF boilerplate application with the following Window.xaml code. The problem is the lack of Value="True" in the <DataTrigger ...> in the template. It throws XamlParseException and Visual Studio errors as described above during debugging.
<Window x:Class="XamlParseExplosion.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <DataTemplate x:Key="BankListItemTemplate"> <Border x:Name="ItemBorder" Width="250" Margin="1" BorderBrush="Blue" BorderThickness="5,0,0,0"> <Grid> <Label Content="{Binding Name}" /> </Grid> </Border> <DataTemplate.Triggers> <DataTrigger Binding="{Binding IsDirty}"> <Setter TargetName="ItemBorder" Property="BorderBrush" Value="Red" /> </DataTrigger> </DataTemplate.Triggers> </DataTemplate> </Window.Resources> <Grid> <ListView ItemTemplate="{StaticResource BankListItemTemplate}" /> </Grid> </Window>
Final notes
The following solutions did not help me :
- Restart Visual Studio
- Rebooting
- Reinstall Visual Studio
- Disabling add-ons like ReSharper and Reflector
Update (path later) w / Answer
I want to add to this (as a pseudo-answer) because I later found out about it later that I want to convey to people who find this question on google.
The real problem: A XamlParseException was thrown in Debug -> Exception to break when this happens, because it happens during a WPF connection. vstudio cannot catch it correctly (usually it falls into several more levels and is processed where vstudio can handle this).
Just turn it off and life will be good again.
I did not want to put this as an answer, because the answer provided by mazelo was also right, when vstudio was launched as an Administrator, it seems to be able to correctly catch the exception and debug from there, so I did not want to take away its response status, because its solution really works.