We have recently moved from using the managed UIAutomation libraries in favor of the UIAComWrapper project which wraps the functionality in the Interop.AutomationClient.dll so that we could maintain our namespaces across our project that uses UIAutomation extensively. Since then, we have had reports of random windows explorer crashes and were able to narrow down the cause and reliably reproduce the issue. This issue does not occur while using the managed UIAutomationClient, however since that is no longer being developed we would much rather take advantage of the native API as it has shown us better results, aside from this crash. See the sample code at the bottom of this post as well as a link to the UIAComWrapper project source code on git hub.
Registering for StructureChangedEvents on the RootElement, with the TreeScope of Children will cause Windows Explorer to crash intermittently. I have been able to reliably cause a crash by either navigating between network drives in Windows Explorer, or more reliably by right clicking the desktop -> Personalize -> Desktop Background and clicking the drop down "Picture Position". The crash occurs at the same location every time no matter how it is reproduced in Windows Explorer, in DUI70.dll, with the same offset every time, with an exception code C0000005. When attached to Explorer.exe in visual studio, I was able to download the public symbols for DUI70.dll and when the exception occured the function that DUI70.dll was currently executing was"RaiseStructureChangeEvent". I was only able to view function headers and the rest of disassembly.
Is anyone else able to reproduce this and have some insight as to what may be causing it?
UIAComWrapperhttps://github.com/JakeGinnivan/UIAComWrapper