現在、 fileSystemWatcherを実装する Windows サービスを開発しています。動画がフォルダーにアップロードされた時点で、filewatcher は作成されたイベントを以下のように起動して動画を変換します。
private void fileSystemWatcher_Created(object sender, System.IO.FileSystemEventArgs e)
{
  if (ConvertVideo(e.FullPath, e.Name))
  {
    WriteToEventLog(String.Format("Successfully converted video - {0}", e.FullPath), EventLogEntryType.Information);
  }            
}
新しいプロセス内で作成されますが、プロセスがクラッシュ/ハング/非表示になるという問題が発生し、他のビデオを変換できないConvertVideoため、メインスレッドが待機中にロックされ、サービスが効果的にクラッシュするように見えます。WaitForExit()プロセスが終了した場合にサービス全体をロックしないようにするにはどうすればよいですか?
private bool ConvertVideo(string SourcePath, string Filename)
{   
   try
   {
      // Create new process
      ProcessStartInfo startInfo = new ProcessStartInfo();
      startInfo.CreateNoWindow = false;
      startInfo.UseShellExecute = false;
      startInfo.FileName = "C:\Handbrake\HandBrakeCLI.exe";
      startInfo.WindowStyle = ProcessWindowStyle.Hidden;
      startInfo.Arguments = GetArguments(SourcePath, Filename);
      int? exitCode = null;
      using (Process exeProcess = Process.Start(startInfo))
      {
        exeProcess.WaitForExit();
        exitCode = exeProcess.ExitCode;
      }
   }
   catch(Exception ex)
   {
     return false;
   }
}
注: この例ではコードが短縮されています