Background: I have a .Net 3.5 WPF \"Prism\"-based application running on Windows XP and Windows PosReady 2009 PCs. The app runs on PCs that are shut down every
We were finally able to get a hold of a production machine exhibiting this behavior and through a number of troubleshooting steps, including sending dump files to Microsoft, the issue was located.
The WPF Font Caching Windows service was occasionally getting into a corrupted state, causing a simple cache request to block indefinitely. This hang caused all of the behaviors described above in the our WPF application.
Simple solution: stop and disable the service. After disabling the service and rebooting the PC the service is no longer in use and we don't see any of these issues. In theory this leads to longer application load times, but we have seen zero negative impact.
Note that there are two versions of the service: 3.0.0.0 and 4.0.0.0. If your application is targeting .Net 3.0 or 3.5 you'll need to disable the 3 service, and if targeting 4.0+ you'll need to disable the 4 service.
Thanks to all for your comments and suggestions.
We have had problems reminding of yours with our WPF application when connecting touch screens. This was due to a bug in the automation framework in .Net. It caused our application to either become very slow or entirely hang the GUI thread.
You can read more about the problem at: http://social.msdn.microsoft.com/Forums/en-IE/windowsaccessibilityandautomation/thread/6c4465e2-207c-4277-a67f-e0f55eff0110
The workaround suggested in the thread above where one removes any listeners of automation event periodically worked for us.
This is not a real answer but since I do not have enough rep? (I guess) I can't use the comment function :)
Try using ANTS profiler to see if you have a memory leak. You can find out easily with just the 2 week trial version that they give.
Have you tried remote debugging the production system?
What you need to remote debug are:
You can attach to an already running process, but you can also start the app from inside visual studio.
If your development system is located far away from the production system, use a laptop and remote desktop to bring your developer studio to the production system. I do this routinely. Even a five metre distance between the two is annoying.
I can elaborate on this, if there's interest, or if you run in to trouble setting up the connection.
Good luck!
Try a global Error catch and see what it produces.
public partial class App : Application
{
[STAThread]
public static void Main()
{
var application = new App();
application.DispatcherUnhandledException +=
new DispatcherUnhandledExceptionEventHandler(application_DispatcherUnhandledException);
application.InitializeComponent();
application.Run();
}
static void application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
LogAndClose("Global exception: " + e.Exception.ToString());
}
public static void Log(string text)
{
try
{
System.IO.File.AppendAllText(Environment.CurrentDirectory + "\\Log.txt",
"[" + DateTime.Now.ToString("MM/dd/yy HH:mm:ss") + "] " + text + "\r\n");
}
catch { }
}
public static void LogAndClose(string text)
{
Log(text);
try
{
Application.Current.Shutdown();
}
catch { }
}
}