Application hang calling System.Diagnostics.Process.GetCurrentProcess()

  • Thread starter Thread starter Heiko Weiss
  • Start date Start date
H

Heiko Weiss

Hi all,

when calling System.Diagnostics.Process.GetCurrentProcess() my application
hangs.
Not every time, but sometimes.

Any suggestions ?

TIA

Heiko
 
Hi Heiko,

From your description, your application will hang randomly when calling the
System.Diagnostics.Process.GetCurrentProcess(). BAsed on my experience,
this is likely a program specific issue. Where and when do you invoke the
call in your application and is there anything else in your application's
context may cause this?

In addition, the System.Diagnostics.Process.GetCurrentProcess just use
Platform Invoke to call the win32 GetCurrentProcessId method to obtain the
current processId and construct a new Process object.

[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
public static extern int GetCurrentProcessId();

So you can also try using the PInvoke to call the unmanaged API directly
instead to see whether the problem still remains. Anyway, I think you can
try make a simple repro program so as to isolate the problem in a more
clear context.

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top