VS 2010 Test Runner error “The agent process was stopped while the test was running.”

前端 未结 19 1531
醉话见心
醉话见心 2020-12-22 21:13

In Visual Studio 2010, I have a number of unit tests. When I run multiple tests at one time using test lists, I sometimes reveive the following error for one or more of the

19条回答
  •  失恋的感觉
    2020-12-22 21:25

    For anyone happening upon this old question and wondering what's being thrown from their thread(s), here's a tip. Using Task.Run (as opposed to, say, Thread.Start) will report child thread exceptions much more reliably. In short, instead of this:

    Thread t = new Thread(FunctionThatThrows);
    t.Start();
    t.Join();
    

    Do this:

    Task t = Task.Run(() => FunctionThatThrows());
    t.Wait();
    

    And your error logs should be much more useful.

提交回复
热议问题