You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using ManagementEventWatcher to listen for WMI changes in a WPF application, the touch functionality becomes unresponsive.
Reproduction Steps
Install the System.Management library to use WqlEventQuery for monitoring WMI changes.
Attach a breakpoint to the TouchDown event to log information.
The complete code for reproduction is as follows:
public MainWindow(){
InitializeComponent();
AppDomain.CurrentDomain.FirstChanceException +=(sender,args)=>{ Debug.WriteLine(args.Exception);};WqlEventQueryinsertQuery=new WqlEventQuery("SELECT * FROM __InstanceCreationEvent WITHIN 2 WHERE TargetInstance ISA 'Win32_USBHub'");ManagementEventWatcherinsertWatcher=new ManagementEventWatcher(insertQuery);
insertWatcher.Start();// When the line `insertWatcher.Start();` is commented out, touching the window hits the breakpoint in the `MainWindow_TouchDown` method. However, after executing `insertWatcher.Start();`, touching the window does not hit the `MainWindow_TouchDown` method.TouchDown+=MainWindow_TouchDown;}privatevoidMainWindow_TouchDown(object?sender,TouchEventArgse){
Debugger.Break();// Never hit}
When the line insertWatcher.Start(); is commented out, touching the window hits the breakpoint in the MainWindow_TouchDown method. However, after executing insertWatcher.Start();, touching the window does not hit the MainWindow_TouchDown method.
Additionally, a FirstChanceException is thrown, with the following exception details:
System.InvalidCastException: Interface not registered
at MS.Win32.Penimc.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
Here is the content of the csproj file used in my code:
Description
When using
ManagementEventWatcher
to listen for WMI changes in a WPF application, the touch functionality becomes unresponsive.Reproduction Steps
System.Management
library to useWqlEventQuery
for monitoring WMI changes.TouchDown
event to log information.The complete code for reproduction is as follows:
When the line
insertWatcher.Start();
is commented out, touching the window hits the breakpoint in theMainWindow_TouchDown
method. However, after executinginsertWatcher.Start();
, touching the window does not hit theMainWindow_TouchDown
method.Additionally, a
FirstChanceException
is thrown, with the following exception details:Here is the content of the csproj file used in my code:
I have uploaded a minimal reproduction project to GitHub. You can clone the project to reproduce the issue.
Expected behavior
It can work well and receive the touch event
Actual behavior
The TouchDown event never be raised.
This issues only happend in .NET Core not the .NET Framework.
Regression?
No response
Known Workarounds
The touch event can be raised after open the WM_Pointer support, because the PointerLogic do not need the COM.
Impact
No response
Configuration
OS version: Windows 11 23H2 22631.4037
Other information
Reference: #9706
We has the similar exception.
The text was updated successfully, but these errors were encountered: