|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Exception occurs when getting ProcessNameI have looked around some of these forums and don't seem to find any post with the similar problem. Could someone point out what could be the problem? Dim myProcesses() As Diagnostics.Process Dim myProcess As Diagnostics.Process Dim sProcName As String myProcesses = Diagnostics.Process.GetProcesses For Each myProcess In myProcesses With myProcess sProcName = .ProcessName 'Exception here. console.writeline(sProcName) End With Next System.ComponentModel.Win32Exception: Unable to enumerate the process modules. at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId) at System.Diagnostics.Process.get_Modules() at System.Diagnostics.Process.get_MainModule() at System.Diagnostics.Process.get_ProcessName() at Process_Controller.ProcessKiller.Main() in C:\My Projects\VB.Net\WindowsUtils\Process Killer\ProcessKiller.vb:line 41 It is possible that processes are being started and/or stopped during
execution. -- Show quoteHTH, Kevin Spencer Microsoft MVP Professional Numbskull Hard work is a medication for which there is no placebo. "Patriot" <tim.***@gmail.com> wrote in message news:1145306326.673470.108610@v46g2000cwv.googlegroups.com... >I am having this error quite often, but not every time. > I have looked around some of these forums and don't seem to find any > post with the similar problem. Could someone point out what could be > the problem? > > Dim myProcesses() As Diagnostics.Process > Dim myProcess As Diagnostics.Process > Dim sProcName As String > > myProcesses = Diagnostics.Process.GetProcesses > > For Each myProcess In myProcesses > With myProcess > sProcName = .ProcessName 'Exception here. > console.writeline(sProcName) > End With > Next > > > > System.ComponentModel.Win32Exception: Unable to enumerate the process > modules. > at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId) > at System.Diagnostics.Process.get_Modules() > at System.Diagnostics.Process.get_MainModule() > at System.Diagnostics.Process.get_ProcessName() > at Process_Controller.ProcessKiller.Main() in C:\My > Projects\VB.Net\WindowsUtils\Process Killer\ProcessKiller.vb:line 41 > |
|||||||||||||||||||||||