Hopefully a nice n simple one for you
Running some tests in VS2010's testing framework. When an exception is thrown somewhere inside it, the results screen shows nothing of the details.
Simplest example:
[TestMethod]
public void DoTest()
{
int y = 10 - 10;
int x = 10 / y;
}
Test method MyProj.DoTest threw exception: ...
You can't see it here, but before the '...' there is some sort of special hidden character (displays as a square). How can I view the details, and ideally, the stacktrace.
Actually, you don't have to add try/catch blocks. If you simply click Debug instead of Run:
it will automatically break there and show you the type of exception:
You must also make sure to go to Debug -> Exceptions (Ctrl+Alt+E) and go to Common Language Runtime Exceptions->System->ystem.DivideByZero exception is either Thrown, or User-andled. If neither of those are checked, nothing will be shown as you debug, and you will get what you described. This, of course, is true for all exceptions.
I would trace through the test code using the debugger until you find the line where the exception is being thrown. That will help you narrow it down.
您只需在“测试结果”窗口中双击失败的测试,或右键单击>查看测试结果详细信息
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.