What happens if I call Process.Start with invalid credentials (i.e., password)? I’m getting a Win32Exception but that doesn’t seem right to me. However, the documentation suggests it’s not designed to report credential errors. Is this a security feature?
What happens if I call Process.Start with invalid credentials (i.e., password)? I’m getting a
Share
No,
Win32Exceptionis correct. If you look a little bit more on the MSDN documentation:Emphasis mine.
I would say, that it isn’t extremely clear. Looking at the code with reflector seems to agree with the documentation.
EDIT
Some plumbing details..
Process.Startwill be throw aWin32Exceptionfor a lot of reasons; pretty much if anything goes wrong starting the process. Internally, .NET is calledCreateProcessWithLogonW, and if that fails, it throws the Win32Exception and sets theNativeErrorCodeproperty on it to whateverGetLastWin32Errorreturned. You can determined why it was thrown by looking at that code. There is a lookup of what each code means here.