Just in case none of the above options worked for anyone I fixed my instance of this error by noticing a corrupt entry in my App.Config due to a missing nuget package in the test project.
For me it was rather frustrating, but I've found solution for my case at least:
If your TestMethod is async, it cannot be void. It MUST return Task.
Hope it helps someone :)
I had the same issue with resharper and I corrected this error by changing an option:
Resharper => Options => Tools => Unit Testing
I just had to uncheck the option "Shadow-copy assemblies being tested"
It was a Resharper issue. In Resharper options->Tools->MSTEST, I unchecked the Use Legacy Runner and now it works.
I was having this problem, and it turned out to be the same as this problem over here. This answer solved the problem for me.
- Uncheck "Only build startup projects and dependencies on Run" (Options -> Projects and Solutions -> Build and Run)
- In Configuration Manager, make sure both the start-up project and the Test project have "Build" checked.
The second time I hit this issue, it was due to an ampersand in the filepath to the project where the tests reside. It works fine with ReSharper's test runner, but not dotCover's. Remove the ampersand from the filepath.
This is a confirmed bug with dotCover.
I faced this problem in vs 2017 update 3 with Resharper Ultimate 2017.2
Restart vs or restart machine can't help.
I resolved the problem by clearing the Cache as follows:
Resharper ->options-> Environment ->click the button 'Clear caches'
Update:
There is a button "error" (I find in Resharper 2018) in the upper right corner of the test window.
If you click the error button, it shows an error message that may help in resolving the problem.
To track the root of the problem, run Visual Studio in log mode. In vs 2017, Run the command:
devenv /ReSharper.LogFile C:\temp\log\test_log.txt /ReSharper.LogLevel Verbose
Run the test.
Review the log file test_log.txt and search for 'error' in the file.
The log file is a great help to find the error that you can resolve or you can send the issue with the log file to the technical support team of Resharper.
For me, simply cleaning and rebuilding the solution fixed it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With