WPF Application Hang - wpf

I'm using Windows 7 Professional (x64) and having installed .NET 4.0 RTM on my machine.
Since 2 days I'm noticing that every WPF application that I'm trying to run hangs and becomes non responsive (a not responding text is appended to it's title bar) and it's painted white.
There is no info regarding any exception, no error message. Nothing. Even the Event Log shows that there was "application hang" event (code 1002) and nothing more.
This problem is for everything that is written in WPF, even for products like NHibernate Profiler and other stuff that I was using on a regular basis without any issues.
Tried to reinstall .NET 4.0 and nothing changed. Any ideas why this might be happening?

I had the same problem. It was a corrupt font cache!!
See http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/7cc032c1-5f4d-4518-adc6-f53afd051e6b for a solution.

If I had to guess I would say video drivers. It might help to try attaching Visual Studio's debugger to the hung process (Debug -> Attach to Process) making sure that Managed Code is the selected debugger type. Then you can break into the debugger and maybe see a common stack trace.

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.

Incorrect Button State with WPF Command

First, let me start off by stating that I will be more than happy to post whatever code or other information I need to in order to help resolve this issue. Unfortunately, at this time, I am just not sure what I need to post.
I have a WPF application that uses the Microsoft Ribbon library. I know the ribbon control has been rolled into the 4.5 framework but since I am still deploying to some XP machines, I am forced to use the 4.0 framework. I mention this only in case there is some obscure issue with the old library.
In the application, I have a RelayCommand that is bound to one of the ribbon buttons that does not enable itself correctly (or at all for that matter). The code that is in place to determine if the command can execute is the exact same as the code for a few other buttons. These other buttons behave correctly. Even worse, the behavior is correct on my machine but not on any of the other machines that I have tried it on. It doesn't appear to be isolated to XP or Windows 7. Even worse, I have placed a regular button in the interface that calls the CanExecute method for the command and it reports a value of True even when the button is disabled.
I am at a complete loss of where to start looking. Perhaps someone can steer me in a direction of where to begin.
Thanks in advance to anyone who is able to assist me in my desperate state.
* EDIT *
On a whim, I installed .NET 4.5 on the machine that was not functioning correctly as this was a glaring difference between the development (my) machine and the other machines. To my surprise, this corrected the issue. That said, are there updates to the .NET 4.0 framework that are applied by installing version 4.5? As I mentioned above, I am targeting some XP machines so I cannot install 4.5. Perhaps there are some other updates that can be installed without installing 4.5?

Debug ActiveX control with Visual Studio 2010

Bit of a strange and very annoying problem.
I'm using Visual Studio 2010 for an ASP.NET webforms project. I was able to set breakpoints in an activex control, load the page and then attach the Visual Studio debugger to the Internet Explorer process running (shows up as Type 'Script, T-SQL, Managed) then reload the page and my breakpoints would be hit.
However, after several small subtle changes (and lots of tidy-up changes), when I do the same thing, my breakpoints are not hit. The breakpoints look okay - the main change is when I look at the Debug > Windows > Modules screen, there are now no references to the iexplore process, even though the debugger is still connected to it.
I'm a bit reluctant to undo all my changes but I suspect that it might be down to ip addresses. Most of the code should run as an ipv4 address but I suspect that the Visual Studio debugger is running with ipv6 address.
Has anyone come across this type of issue, where ip address versions are messing up debugging processes?
Okay, found the solution to this after a week! It was nothing to do with IP addreses. The ActiveX component was limited to .NET 3.5.0 and so when it was loaded by IE, it ran in .NET 2.0. The rest of the project was .NET 4.0 and when Visual Studio was debugging it automatically debugged code type 'Automatic: Native' which defaulted to .NET 4.0. Although I could attach to the IE process and all the breakpoints looked ok (solid circles), none of them were hit because no symbols were loaded. Clicking the 'Select' button when attaching to the IE process, allowed me to choose Managed(v2.0, v1.1, v1.0) code and the breakpoints were hit. You can't debug both .NET 4.0 and .NET 2.0, but you can use two seperate instances of Visual Studio to debug your complete project.
Hope this helps anyone else who trips over this one like I did.

Silverlight 4 OOB White Screen of Death. Failed to load pre-requisites for the application

I'm developing a SL4 OOB application that has suddenly started giving me the white screen of death.
If I try to run it 'in-browser' and check the console I can see the error 2105 : 'Failed to load pre-requisites for the application' but there's very little info about it anywhere.
None of my breakpoints get hit. Even starting the app with F11 (step into) doesn't get me anywhere.
I can run other Silverlight projects just fine so it's not the runtime. I've even copied the source into another project to see if that might help but to no avail.
Does anyone have any ideas how I might get started fixing this?
I have seen this myself and it was a pain..
What I had to do was a system restore, de-installed all traces of Silverlight and Blend and then reinstalled them all. However I had also just installed Silverlight 5 RC which didn't play nicely with Telerik and might have been the problem.
There is also some information about this error here:
http://connect.microsoft.com/VisualStudio/feedback/details/530074/unhandled-error-in-silverlight-application-2105-when-building-as-an-x86-configuration.
Is this your problem?
Damn it, I hate answering my own questions but the problem was quite obscure.
Somehow, I managed to get a regular .Net reference in my Silverlight project through a Nuget package. That was it.
DOH!

Why does Inspect.exe not display the AutomationId and other UIAutomation properties when running in debug?

I've been using Inspect.exe from the Windows SDK to examine the properties of a WinForms application but noticed that I didn't see any of the properties (for example, the AutomationId) whilst running the application from Visual Studio (F5 to run.) However, if I ran the .exe from the bin\debug folder I could see the properties fine.
The source I was using was example code downloaded from UI Automation Custom Provider Samples - Part 3.
I'm wondering why this happened since I'm sure another machine that I had tried this on worked fine and I wasted time poking around in debug mode wondering why my UI Automation properties weren't visible. Obviously there's a workaround but I'd like to understand why this was happening and have a record of the problem for other people to find!
I've struck upon the answer - because I had launched Visual Studio as Administrator but the Inspect.exe tool as standard user then the properties being reported back were a sub-set of what I should have seen. As soon as I launched Inspect.exe as Administrator it worked!

Resources