WPF application freezes when rendering text (wpfgfx issues)
The connection is: Windows Presentation Foundation Font Cache service.
Sources:
- http://support.microsoft.com/kb/937135
- http://social.msdn.microsoft.com/Forums/vstudio/en-US/7cc032c1-5f4d-4518-adc6-f53afd051e6b/presentationhostexe-running-at-50-cpu?forum=wpf
WPF uses a Font-Cache service, running as a separate process, for, well, caching fonts. Whenever your WPF app needs to draw some text, it might ask the cache service for fonts. Once in a while the font cache might get corrupted and it then will/may randomly impact any WPF application.
Unfortunatelly, restarting the service is not enough. When this happens, you must delete all FontCache
files that this service keeps on the disk. Before deleting them, you must stop the "Windows Presentation Foundation Font Cache
service (or whatever it's called in your languge, for example Usługa buforowania czcionek platformy Windows Presentation Foundation
in Polish..). Then, go to
- Win7:
%systemdrive%\Windows\ServiceProfiles\LocalService\AppData\Local\
- Vista:
%systemdrive%\Windows\ServiceProfiles\LocalService\AppData\Local\
- WinXP:
%systemdrive%\Documents and Settings\LocalService\Local Settings\Application Data
and remove all files looking like FontCache.dat
. The source articles mentioned only one file (FontCache3.0.0.0.dat, but in my case there were around 8 files with similar naming convention).
After deleing them and restarting the service, all versions of my application were running properly again. No black screens, no freezing on textbox.