I am trying to debug into xaml in silverlight 5 project. When debugger hits a breakpoint it correctly stops, I can read binding properties, but I can`t continue.
When I hit the continue button, button turns to gray and nothing happens. All debugger buttons are inactive. The only way to stop is to close the solution. While closing solution many error messages pup up saying: "Source file XY does not belong to the project being debugged."
There is no problem with debugging in C# only in XAML.
Any help will be greatly accepted.
Thank you in advance.
Try deleting the .suo solution user file, which may have become corrupt. Back it up first ;-)
Related
The best way to explain this is to describe how I can reproduce the problem at will.
Open an existing Windows Form file in the designer
Open the toolbox and click a custom UserControl
Click in the form in the designer to add it
VS2013 hangs (does NOT crash); kill VS2013 and relaunch it
Open the form again
Reset the toolbox and re-add the DLL that contains my custom UserControls
Try adding the control to the form--it works just fine!
Close VS2013
Open VS2013
Repeat the task of adding the custom UserControl to a form
VS2013 hangs
So, the moral of the story is that after closing and reopening VS2013, any attempt to add a custom usercontrol will hang VS2013, and the only way to remedy it is to reset the toolbox and re-add the usercontrol DLL; that remedy only lasts until VS2013 is exited and launched again.
Lots of googling has yielded suggestions regarding using a second VS instance to attach to the first and see the exception that is thrown, but there's no exception being thrown; the application just hangs.
The one thing I found that most-closely described my issue turned out to be related to some remote-desktop software that I'm not using.
Anybody got any ideas? I haven't tried reinstalling Visual Studio, as that represents a fairly significant amount of down-time. Last resort sort of thing (and I've read some things that indicated it won't be helpful).
Edit: Apparently sometimes the reset/re-add doesn't make it better.
Edit: Some additional things I should have mentioned:
There is no devenv.exe when I try to use a second VS instance to
debug, so I end up choosing WDExpress.exe
The particular user control is mature and has not changed recently, and is in use on many forms in the project
The issue only occurs when adding a new instance of the control; the hang does not occur simply by attempting to launch the designer for a form that already contains one.
The latest VS2013 update may have fixed it; it's not happening right now and I don't want to anger the gods by trying to reproduce it again until I get my work done.
Hanging Visual Studio with a custom UserControl is very easy to do. A simple example is all it takes, double-click the design surface and write:
private void UserControl1_Load(object sender, EventArgs e) {
while (true) { }
}
Compile and drop the added control from the top of the toolbox and drop it on a form. Show is over.
You probably did not spend enough time using the guidance you already found or we'd have a stack trace to look at. Attaching a debugger is easy enough and you'd be ahead if the code throws an exception. But it doesn't, a hang like this doesn't throw. Exercise debugging this particular simple hang to find out how to do it:
Start VS again, Debug > Attach to Process > select devenv.exe
Important: click the Select button above the process list. You'll need to select the "Debug these code types" radio button and tick "Managed (v4.5, v4.0)" as well as "Native". Now click Attach.
Give it time to load the symbol files, takes quite a while, especially if that was never done before.
Use Debug > Break All.
If you are lucky then it now stops on the exact statement that causes the hang. Likely in this case. This is however not guaranteed, it might also break on one of the many threads that are running inside devenv.exe, which ever happened to be active at the exact moment the debugger broke in.
In which case you need to use Debug > Windows > Threads to select the thread on which the UserControl code is running. Should be the one labeled "Main Thread". Double-click it.
If the editor doesn't switch to the source code file with the hang then use Debug > Windows > Call Stack to get insight in how the hang occurred. Update the question with that trace if you need more help.
In general, prime candidates for code in your UserControl that can cause the hang are its constructor, its Load event and its Paint event. Use the DesignMode property to bypass dangerous code that is not likely to work well when it runs inside the designer instead of the regular process. And beware of the chicken-and-egg problem, if you have a plain bug in your UserControl then it can easily strike first at design time, before you get a chance to debug it like you normally would. Disabling chunks of code may be necessary to increment towards the bug, use DesignMode to get there.
One more detail, this is tagged [c++-cli]. You must select the old debugging engine to debug C++/CLI code. Tools > Options > Debugging > General > tick the "Use Managed Compatibility Mode" checkbox.
The issue seems to have vanished subsequent to updating VS2013 to 12.0.40629.0 Update 5, found by selecting TOOLS > Extensions and Updates, then selecting Updates on the left.
It may not work in all cases of seemingly-inexplicable UserControl-incited hangs in the Designer, but it seemed to solve the problem for me. I'm putting this here (rather than deleting the question) in case my experience can help someone else.
I added an empty status strip in my empty form and when I try to save this error pops up one time:
On the next attempt I can save until I change the StatusStrip. When I start the application or re-open the designer it will show my StatusStrip, but none of my added buttons in the StatusStrip. However, the produced designer code still contains the code of the buttons.
Does anybody experienced this bug or is there any way to get further information to solve it?
Restarting Visual Studio solved this temporary issue at me.
My Silverlight website hangs at 100% loaded. There is no code for it, so far it is just the design in XAML, and it shows up fine in Expression Blend 3. It is the standard "Silverlight Website" project from Blend 3, without any modifications.
When I press F5 to run it, it shows as a 100% loading circle in firefox and never actually shows my app. The loading circle continues to animate as if its doing something.
Note: It worked yesterday, and I havent made very many changes to it since then.
I had this problem in browser, out of browser - even when debugging. Using Silverlight 4 beta.
I hit F5 to start debugging and it never even hit a breakpoint for the constructor of App.xaml.cs.
I knew I'd uninstalled an out of browser app and changed some out of browser settings recently but nothing would tell me the actual problem.
I found in the end if I ran in IE (normally I use Chrome) - then an error icon would be shown in the bottom left - as if it were a javascript error.
Webpage error details
Message: Unhandled Error in Silverlight Application
Code: 2020
Category: ParserError
Message: Invalid Property: OutOfBrowserSettings.
File:
Line: 47
Position: 27
Line: 54
Char: 13
Code: 0
URI: file:///R:/Project/Projece/Bin/Debug/TestPage.html
Well this didn't get me any further - except to tell me something was messed up with OutOfBrowserSettings.
What I ended up doing was creating a new AppManifest.xml. As of Silverlight 4 this is the default AppManifest.xml.
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Deployment.Parts>
</Deployment.Parts>
</Deployment>
I disabled 'create app manifest' and reenabled it. After toggling some of the settings back and forth - and even creating AppManifest2.xml I managed to get it working again.
I switched back to my original AppManifest.xml and it worked.
The point being check any message the browser gives you - and then change things that you don't think will make a difference.
Good luck!
I figured out the problem after looking at the XAML. On the height property of one of my buttons, there was a line break right before the ending quote. Expression blend didn't mark it as an error, and everything showed up fine in design mode.
When I removed the line break, the loading problem was fixed.
My other answer looks quite convoluted compared to this. This may or may not help in this situation but its worth a try:
In Visual Studio :
Click Debug > Exceptions
Click 'Find' and search for XAML
Click the 'Thrown' button next to System.Windows.Markup.XamlParseException
Start your project in debug mode. Any Xaml exceptions will be shown immediately. Check the inner exception sometimes for further information.
I wasted soooo much time before I finally figured this one out!
Here is the answer: http://www.cnblogs.com/101rico/archive/2012/11/14/2769781.html
You can add this: xmlns:Grid="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
This also happens when the Silverlight app requires Silverlight 5, but the user has a lower version installed.
An infinite event loop can cause this problem:
private void myComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
myComboBox.SelectedIndex = 0;
}
If it is an elevated trust application, failing to have the necessary registry settings set to allow its launch can cause the dreaded "100% hang":
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Silverlight
AllowElevatedTrustAppsInBrowser DWORD:=1
AllowLaunchOfElevatedTrustApps DWORD:=1
Open Internet Explorer, go to Tools-> Internet Options->Advanced->click Reset on Reset Internet Explorer Settings-> choose Delete Personal Settings->Click reset
So my problem was, in a data grid, I had a duplicate column name binding to the same column name. So something in the xaml was crazy messed up. Apparently the control I am using had an "Internal Exception" that was not being thrown up on the screen as an error.
I have a binding in Silverlight that is causing my application to exit. An unhandled exception is not throw; I just get a white screen.
I am not seeing anything from the binding engine in the output window.
Does anyone have any ideas for debugging this issue?
I suggest you use Karl Shiflett's Glimpse for Silverlight for that.
Also, I just "heard" Laurent Bugnion on twitter recommend using a mock Converter on a binding to figure out why it's failing. That's a good idea in case you're unsure as to what values are being fed to the binding.
Dave, dont get too excited about the XAML debugging in SL5. I have been building projects for a few weeks now in SL5 and all I can say is that the XAML debugger will break after very little use and all you will get back is the ridiculous error message saying that the PDB's cant be found. I have reset my VS2010 setting numerous times and still the debugger remains crippled. I have spend days if not weeks trying to get to the bottom of the cause and as usual there are no support documents or help sites for this issue. Debugging Silverlight databindings is a black box scenario and a huge weakness in this technology. There is no way of knowing what the XAML parser is doing or not doing as the case may be. I have just had to scrap a project because of a total failure of the bindings in the View. The VM is preforming correctly by all bindings on the view fail. People will tell you that the output window in VS2010 will indicate the binding errors. My experience is that you can have total failure of bindings and NO errors will be shown in the output window. If you get into this scenario there is simply no solution that I am aware of and even the bug ridden XAML debugger wont be able to help you.
I'm having some trouble with Visual Studio 2008 on my Windows XP SP2 laptop.
What happens is that when I start a program with a few textboxes and stuff like that, the boxes are see-through. I can litteraly see through them and see what's on the underlaying screen. Like if I only have this Form showing and behind that my wallpaper, I can see my wallpaper through the Textbox, ComboBox, even through the small cracks between various elements.
i've searched the web but haven't encountered info on this yet. Does anybody know what might be causing this and how to solve it? I'm in the process of trying to see how the text in my TextBoxes is parsed, but I can't since I can't even enter anything. I click on the textbox and I'm focused on the desktop...
Hmmm... I'm not sure about this, but check the "Transparency" property of your main form. That's all I can think that it might be as of now...
Update: I meant the "Opacity" property, sorry.
Update 2: No, never mind, sorry. Right-click the "TransparencyKey" property, and press Reset to set it back to default.
Check TransparencyKey, Opacity and maybe TransparencyMask?