jascam / AnotherMigrateTest

0 stars 0 forks source link

Process with an Id of -1 is not running. #49

Open jascam opened 7 years ago

jascam commented 7 years ago

Sometimes I run into this System.ArgumentException: HResult=-2147024809 Message=Process with an Id of -1 is not running. Source=System StackTrace: at System.Diagnostics.Process.GetProcessById(Int32 processId) at SharpVectors.Converters.MainStartup.Main(String[] args) in \Main\Samples\WpfConverters\MainStartup.cs:line 30 InnerException:

Line 30: Process process = Process.GetProcessById(processId);

should be replaced with: Process process; try { process = Process.GetProcessById(processId); } catch { process = null; }

This work item was migrated from CodePlex

CodePlex work item ID: '1721' Vote count: '2'