Unit Test Adapter threw exception with no stack trace in TeamCity 7.1.5

Nick Williams

We have an ASP.NET MVC 4.5 project. For months it has been compiling and all unit tests passing locally on our development machines and on the TeamCity 7.1.5 machine. Monday we updated to newer versions of some of our dependencies (specifically, to get OData 5.0.0-rc1 for select-expand).

The project compiles fine on our development machines and the build machine. It runs fine on our development machines and on both QA environments it's deployed to. All the unit tests pass on our development machines. However, about half (~300) of the unit tests now fail when run from TeamCity using the MSTest build runner, all with the same, useless error:

Unit Test Adapter threw exception: 
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

I've tried everything imaginable. At first I figured there was a legitimate problem. Since there's no way to retrieve the LoaderExceptions property from TeamCity (why doesn't MSTest just display more information!?!?), I logged in to the machine TeamCity is running on, opened up the console, changed into the work directory that our build is running from, and ran the tests manually so that I could retrieve the property. ALL OF THE TESTS PASSED! There goes that theory...

After an entire day of Googling and reading other answers on StackOverflow, I've tried about two dozen different combinations of the following steps:

  • Changing the build from "Rebuild" to "Clean," running it without tests so that it just cleans, changing it back, and running it again.
  • Changing the build from "Debug" to "Release," running it, and changing it back again.
  • Cleaning agent sources from TeamCity admin pages.
  • Manually deleting entire work directory off of the agents, skipping the recycle bin and going straight to the netherworlds.
  • Deleting all source control (TFS) caches off the build machine and agents.
  • Telling TeamCity to clean the work directory before getting latest from source control.

I've reached the end of my troubleshooting capabilities. The tests just won't run anymore on the build machine, for apparently no reason at all.

What can I do? What the heck is going on?

Nick Williams

The short answer to this is, "It's a bug."

I reported the bug to JetBrains. It appears that, though there might be some underlying problem with my project, it's only a problem when run from Teamcity, and it's impossible to retrieve the actual error message, so there's no way to know what that problem is. The runner should be catching the exception and printing out the LoaderExceptions property, but it isn't. Instead, it's just calling ToString() on the exception. The runner will have to be updated to look for this specific exception and print the LoaderExceptions property. Once that happens, then we can see the underlying problem, which may result in changing something in the project, or it may result in filing another bug with JetBrains.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Unit Test Adapter threw exception: URI formats are not supported

From Dev

Unit Test Adapter threw exception: Unable to load one or more of the requested types

From Dev

Exception Stack Trace Missing Items

From Dev

Why is the exception stack trace not logged in?

From Dev

The type initializer for Form1 threw an exception

From Dev

Stack trace not providing exception source method when using async in Silverlight 5

From Dev

Java Unit test for Exception

From Dev

Unit test a custom Exception

From Dev

unit test on exception

From Java

How to print the stack trace of an exception object in Python?

From Dev

Exception that emails stack trace when raised

From Dev

locals() and globals() in stack trace on exception (Python)

From Dev

How to use a stack trace dump to debug an exception?

From Dev

Rethrow an Exception with correct line numbers in the stack trace

From Dev

How can an Exception be created/thrown with no stack trace?

From Dev

logback: newline before exception stack trace but not otherwise?

From Dev

Exception stack trace and aggregation in Parallel.ForEach

From Dev

Suppressing stack trace when catching exception

From Dev

How to print the stack trace of an exception object in Python?

From Dev

locals() and globals() in stack trace on exception (Python)

From Dev

How to use a stack trace dump to debug an exception?

From Dev

cxf null pointer exception without stack trace

From Dev

Printing the stack trace vs the exception itself

From Dev

How does the console obtain the stack trace of an exception?

From Dev

Unit test of Cuda code running on a TeamCity agent

From Dev

Unit test of Cuda code running on a TeamCity agent

From Dev

Tomcat 7 HTTP Status 500 - Servlet execution threw an exception

From Java

Get exception description and stack trace which caused an exception, all as a string

From Dev

Stack trace in Xcode 5 won't work

Related Related

  1. 1

    Unit Test Adapter threw exception: URI formats are not supported

  2. 2

    Unit Test Adapter threw exception: Unable to load one or more of the requested types

  3. 3

    Exception Stack Trace Missing Items

  4. 4

    Why is the exception stack trace not logged in?

  5. 5

    The type initializer for Form1 threw an exception

  6. 6

    Stack trace not providing exception source method when using async in Silverlight 5

  7. 7

    Java Unit test for Exception

  8. 8

    Unit test a custom Exception

  9. 9

    unit test on exception

  10. 10

    How to print the stack trace of an exception object in Python?

  11. 11

    Exception that emails stack trace when raised

  12. 12

    locals() and globals() in stack trace on exception (Python)

  13. 13

    How to use a stack trace dump to debug an exception?

  14. 14

    Rethrow an Exception with correct line numbers in the stack trace

  15. 15

    How can an Exception be created/thrown with no stack trace?

  16. 16

    logback: newline before exception stack trace but not otherwise?

  17. 17

    Exception stack trace and aggregation in Parallel.ForEach

  18. 18

    Suppressing stack trace when catching exception

  19. 19

    How to print the stack trace of an exception object in Python?

  20. 20

    locals() and globals() in stack trace on exception (Python)

  21. 21

    How to use a stack trace dump to debug an exception?

  22. 22

    cxf null pointer exception without stack trace

  23. 23

    Printing the stack trace vs the exception itself

  24. 24

    How does the console obtain the stack trace of an exception?

  25. 25

    Unit test of Cuda code running on a TeamCity agent

  26. 26

    Unit test of Cuda code running on a TeamCity agent

  27. 27

    Tomcat 7 HTTP Status 500 - Servlet execution threw an exception

  28. 28

    Get exception description and stack trace which caused an exception, all as a string

  29. 29

    Stack trace in Xcode 5 won't work

HotTag

Archive