Skip to content

Commit

Permalink
Don't fail when AssemblyRunner.Dispose throws
Browse files Browse the repository at this point in the history
  • Loading branch information
qmfrederik committed Sep 5, 2018
1 parent fd72d9d commit 38f2c49
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions demo/cliscd/Program.cs
Expand Up @@ -21,21 +21,28 @@ static int Main(string[] args)
string testAssembly = typeof(Program).Assembly.Location;
var typeName = args.Length == 2 ? args[1] : null;

using (var runner = AssemblyRunner.WithoutAppDomain(testAssembly))
try
{
runner.OnDiscoveryComplete = OnDiscoveryComplete;
runner.OnExecutionComplete = OnExecutionComplete;
runner.OnTestFailed = OnTestFailed;
runner.OnTestSkipped = OnTestSkipped;

Console.WriteLine("Discovering...");
runner.Start(typeName);

finished.WaitOne();
finished.Dispose();

return result;
using (var runner = AssemblyRunner.WithoutAppDomain(testAssembly))
{
runner.OnDiscoveryComplete = OnDiscoveryComplete;
runner.OnExecutionComplete = OnExecutionComplete;
runner.OnTestFailed = OnTestFailed;
runner.OnTestSkipped = OnTestSkipped;

Console.WriteLine("Discovering...");
runner.Start(typeName);

finished.WaitOne();
finished.Dispose();
}
}
catch (InvalidOperationException)
{
// Swallow
}

return result;
}

static void OnDiscoveryComplete(DiscoveryCompleteInfo info)
Expand Down

0 comments on commit 38f2c49

Please sign in to comment.