Windows Service stops triggering monitoring event for starting process
I am developing a Windows Service Application in VB.net (using WMI). The application monitors for occurrence (Start) of any new event/ process in Win32 environment. The code which I am using for handling this monitoring event is as under:-
WithEvents Watcher As ManagementEventWatcher
Watcher = New ManagementEventWatcher(New WqlEventQuery("Select * From Win32_ProcessStartTrace"))
AddHandler Watcher.EventArrived,AddressOf ManagementWatcher_StartEventArrived
The problem which I have been facing is that the application works fine in case of service installation/un-installation, begin and stop, at its first run i.e. systems startup but stops triggering monitoring event for starting processes, if we un-install and then again install and begin the service after span of some time (5-10 Mins). Moreover, the service is responding/triggering all remaining events, except the aforementioned monitoring event.
The odd behavior of the service will remain to continue until and unless I reboot my computer.
Please help me in this regard.