Visual Studio freezes on breakpoints - wpf

Since a week back I'm seeing a very annoying behavior from VS2010:
As I'm debugging a project and the debugger stops on a breakpoint Windows freezes for almost ten seconds. I say "Windows freezes" because the mouse and keyboard are useless during this time period.
The problem only happens as I debug a specific project and I've tried it on two diffrent machines with the same result. The project is WPF and I do hook the keyboard at one point (not the mouse though) but that code hasn't been touched for months while the problem is just a week old.
I did install Telerik's big suite of everything (trial) just before this started to show so my first suspicion was Telerik's VS integration was the culprit. I uninstalled all Telerik VS integrations (the "JustXXX" products) but the problem remain.
I would be very greatful to anyone being abe to give a hint as to what might be going on here.
Thanks
EDIT 1:
I have now tried building a new solution, moving all projects into it but the problem remains.
I then uninstalled everything Telerik, just to make sure, but this also was to no effect.
The next test was to load the exact same solution on a different machine and that did help. That machine has no 3rd party integrations with VS2010 except for reSHarper 6.1.
I have also analyzed the issue bit more and the typical scenario is that the first few times a breakpoint is hit the UI freezes for apeoximately ten seconds. Mouse/keyboard stops responding but the cursor keeps blinking in the code editor. The next few breakpoints does the same and often stepping from one line to another will cause a very long delay (no UI freeze though).
Also, if the first breakpoint is set very early in my application startup code I might not experience the problem. But as I continue to step through the code the debugger becomes more sluggish as the application initializes itself (in separate threads).
As I've said before this happens for a single application so the code is clearly related somehow.
Does anyone have good knowledge of how the debugger operates? Apart from the obvious steps needed whenever a breakpoint is set or the user steps from one line to another (refresh stack trace and watch windows) what is going on in the background that might freeze up everything and how is it possible?
My last hope is a complete reinstall of VS2010 but I hope I can solve this before that option is required.

I have finally found the cause for this weird behavior. As I mentioned in the original post I do hook the keyboard (AND mouse, I had forgotten I did that) during the application's initialization in order to be able to detect user inactivity.
The monitoring takes place in a background thread that simply waits for an AutoResetEvent to discover user activity or inactivity. For some odd reason the AutoResetEvent.WaitOne(...) somehow affects the debugger. My current fix is to just avoid the wait if the debugger is attached.
I still cannot explain why this happens now. It has been working for a year but the cause for the problem is finally found and dealt with.
I have submitted my question to Microsoft, hoping to get a good explanation. If I do I will post it here.

If you really have the problem with one Project / Solution you could try to create a new empty solution and add the project there, maybe this helps.
I don't really know much about the inner workings of Visual Studio (after all it must be one of the most complex pieces of software out there). But what I've learned is, that a reinstall often is the best and fastest solution (even if it takes an hour or two). Just make sure you backup any settings you don't want to lose.
Update:
I found this one here, maybe you've already found it too: http://connect.microsoft.com/VisualStudio/feedback/details/260864/visual-studio-debugger-occasionally-locks-up-the-entire-windows-gui
You could give it a try and disable the language bar.

Related

Silverlight 4 Out-Of-Browser issues: app displays blank (white) screen, no exceptions thrown, no breakpoints hit

I'm having issues with Silverlight 4 Out-Of-Browser, as specified in the title.
What I did:
Update project settings to enable Out-Of-Browser. This enabled OOB, but when I ran the app in this way it just displayed a white screen.
What I have done to try to fix this:
All references to the System.Windows.Browser.HtmlPage (to avoid DOM interaction) have been removed as per various sources including this SO question and this blog post.
Remove any references to SizeChangedEventHandler as per this SO question.
Clean projects/solution, including ideas such as deleting *.suo files as per this blog post
Uninstalling the installed OOB app, reinstalling
Also:
As commented on by "kobruleht" here, attempting to attach the debugger does not appear to work. Visual Studio (2010, SP1) reports that it is attached without help from me, but breakpoints are not being hit.
And so:
Can anyone advise on other courses of action? At the very least I'd like to be able to step through and hit breakpoints (or even break on Exceptions!)
OK, I have a resolution.
In AppManifest.xml I specified assemblies to be loaded, one of these was not loading correctly, which meant that App.xaml.cs->App()was never reached. The problem is difficult to diagnose because the program runs, with no errors or exceptions, but then displays a white screen - quite misleading.
For anyone experiencing the same problem, the simplest debugging steps to take in this case is to run the app in in-browser mode, copy the results from the Output window, then compare the results from the Output window when you try to run in OOB mode. Any discrepancies will give a good hint to the problem.
I should also mention, that I have not had trouble with SizeChangedEventHandler as mentioned above.

Visual Studio 2010 messes up visually

Not sure what is going on here, if it's just my computer, or a VS bug. It is annoying.
When scrolling, text in VS sometimes gets really messed up. it also happens to other window elements on occasion.
I've noticed something similar in Dreamweaver CS4 & CS5, so I don't know if it's my computer or something with WPF.
Any way to fix this problem?
Windows 7 Pro
This is most likely a general WPF issue, and could be related to your graphics drivers.
I would recommend looking for updated graphics drivers for your graphics card. If this doesn't work, try reducing the amount of hardware acceleration, as this tends to clean up many WPF rendering issues.
I would suspect this is a WPF issue that may be resolved by updating your graphics drivers if your card can handle it as Reed Copsey suggested.
If you don't have any luck with that, you can try turning off some of the hardware-accelerated rendering by going to the Tools menu, selecting Options then disabling the Automatically adjust visual experience based on client performance option and the following two options under the Environment > General section.
MSDN put up an article not too long ago that can help troubleshoot the problem.
http://msdn.microsoft.com/en-us/vstudio/ff716700
The first two things I would try would be to update your video drivers. Then maybe turn down hardware acceleration.
This KB article touches upon how to do it about half way down the resolution section.
http://support.microsoft.com/kb/263039
I have similar problems with my VS2010. It isn't a graphic driver issue but an issue with WPF/VS2010. I was hoping the SP1 would solve this problem, but it didn't.

YouTube XL in WPF WebBrowser?

I'm trying to create a simple HTPC interface and found YouTube XL (http://youtube.com/xl) which i thought would be cool and easy to add to my program.
I'm using WPF so i simply tried to add a System.Windows.Controls.WebBrowser and navigate to that adress.
The problem is that there is no video, everything else around the actual video works fine and other pages(including normal youtube) works fine. Youtube XL also works fine in normal Internet Explorer(8).
Is there anything that differs between IEs and WPFs browser control that might cause this problem?
Edit: I am compiling the program for x86, otherwhise flash doesn't work at all. All other web pages i have tried, including normal youtube, works just like normal.
The strangest thing is that it worked once! The first time i tried it i got video, since then there is only black :(
There shouldn't be a difference. You might be subject to this bug (and workaround) if you are using an x64 version of Windows:
http://blogs.msdn.com/uberdemo/archive/2009/07/09/circumventing-an-ie-flash-display-issue-in-the-wpf-webbrowser-control-on-x64-machines.aspx
You need to set the project to compile for x86 processors, since on x64 systems the 64-bit webbrowser is used, which, when i last checked, didn't have a working flash plugin yet. Not sure if there is one now, though.
OP here, accidentally ate my cookies.
Deleting browser history in Internet Explorer solved the problem.
Deleting the ie history and cache only resolved the issue as a one time thing only.

wpf app appears to be blocking extended screen functionality on hp laptop

I ran into a strange issue where "fn_key -- F4" combination on my hp laptop to extend the screen would stop working once I have a wpf application running. This happens even when I create an empty app -- as soon as I run it, I can't extend my desktop to a second monitor.
Thanks!
Sounds like an issue with your video driver. What kind of video card is it? Are you running the latest drivers from the vendor?
The problem was a driver issue (as Drew mentioned above).
To diagnose an issue like this, please follow the instructions from the MSDN article (http://msdn.microsoft.com/en-us/library/aa970912.aspx) on how to disable hardware acceleration and render everything in software.
Provided your issue is similar to what I have experienced, you will be able to single out the problem by adding the necessary registry key from the article.

VS2008 silently dies A LOT when working with WPF

When working in VS2008 (C#) does VS2008 silently crash for anybody when working with WPF? If I touch the XAML it is most likely to crash. I can come back in, clean, then build, then run and it work until I have to touch the XAML again. Then start over again.
It is a solution with about 12 projects in it.
Thanks,
jeff
https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=375594
Workaround:
Found real workaround at http://www.dotnet6.com/blogs/wesley_walraeve/archive/2008/10/22/visual-studio-2008-sp1-crashes-toolbox-gt-choose-items.aspx, which was removing TFS Power Commands 2008. Other people have had to remove other things.
SP1 solves a bit of the crashes, but indeed it crashes a lot. Especially when you mix and match winforms + WPF. The crashes alone were a reason to stick with winforms for a while for us ...
I found the problem to be with the AnkhSvn plug-in. I went to a nightlybuild and it is working good now. Anything above 2.0.6110.379.
I and some other people at my company have had a lot of problems when editing a resource dictionary and while a XAML window that uses that resource dictionary is open. Moral of the story, close all XAML windows if you're going to edit a resource dictionary.
We suffer the same problems... I noticed that resharper makes things worse for the WPF editor from time to time...
Ah well.. a daily VS crash keeps the doctor away ?
VS crashes at my computer very often: several times per day when I work with WPF. But usually it stops responding and I don't remember it to crash silently.
I know, it's not nice, but simply cleaning the solution works for me. At least until the next restart of VS, but until then you shouldn't get any crashes.

Resources