I have been working on an application, and was trying to figure out why my CPU usage was hitting 80-100%.
I narrowed it down to the TextBox controls in my WPF page. It turns out that if I put focus on them it would start hammering the wmiprvse.exe process. This sent my overall CPU usage up to 100%.
I then created a test WPF application to see whether it may have been underlying code, or whether it is just the TextBox that is the culprit. Turns out, IT IS!
My test form only one text box, but as soon as I put focus on it to start editing some text, my CPU rockets to 100%.
Has anyone else experienced this problem, and do you know of any workaround?
Update
Well I have figured it out.
In another application I was using a ManagementEventWatcher. I was querying every second so I may have been creating a backlog somehow.
Here is a little sample of what I removed:
private ManagementEventWatcher processCreateWatcher = new ManagementEventWatcher();
processCreateWatcher.Query = new WqlEventQuery("__InstanceCreationEvent", interval, "TargetInstance isa \"Win32_Process\"");
processCreateWatcher.EventArrived += new EventArrivedEventHandler(processCreateWatcher_EventArrived);
processCreateWatcher.Start();
Next time I better be careful when using the Management class!
I don’t have a problem with TexBox and it is a common and widely used control. I suspect something in your environment that is triggered by a TextBox focus.