jtilander / niftyplugins

Visual Studio productivity plugins
MIT License
40 stars 24 forks source link

Visual Studio crash/shutdown if P4.exe process returns an exit code #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open a solution, select NiftyEdit from a context menu for a CPP file
2. Wait a few seconds. 
3. If the server is unreachable (e.g. VPN not connected) or P4.exe returns an 
error code Visual Studio will receive an exception thrown from NiftyPerforce 
and be shut-down or restarted.

What is the expected output? What do you see instead?
I expect to see an error message (with explanation) instead of a crash.

What version of the product are you using? On what operating system?
Nifty Perforce 1.3.9. Windows 7 Ultimate, Visual Studio 2008

Please provide any additional information below.

This piece of code from RunCommand in AsyncProcess.cs throws an exception if 
the ExitCode isn't 0, but the exception is never caught.

if (0 != process.ExitCode)
{
  throw new Process.Error("Failed to execute {0} {1}, exit code was {2}", executable, process.StartInfo.Arguments, process.ExitCode);
}

The RunCommand method currently only catches 
System.ComponentModel.Win32Exception exceptions which leads to Visual Studio 
catching the exception and shutting down.

It's probably safer to catch all possible exceptions when executing a new 
process?
  catch(Exception e)
  {..
  }

Original issue reported on code.google.com by danie.co...@gmail.com on 10 Jul 2012 at 9:31

GoogleCodeExporter commented 9 years ago
Fixed in 1.4.0

Original comment by jim.tila...@gmail.com on 15 Sep 2012 at 4:44