Categories
Development

System.IO.FileLoadException: Could not load file or assembly ‘testhost, when debugging tests

Everytime I try to debug unit tests from Rider IDE, test execution fails with an exception

System.IO.FileLoadException: Could not load file or assembly
‘testhost, Culture=neutral, PublicKeyToken=null’. Could not find or
load a specific file. (Exception from HRESULT: 0x80131621) File name:
‘testhost, Culture=neutral, PublicKeyToken=null’

StackTrace:

at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, IntPtr ptrLoadContextBinder)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Xunit.Runner.VisualStudio.VsTestRunner.GetAvailableRunnerReporters(IEnumerable`1 sources) in C:\Dev\xunit\xunit\src\xunit.runner.visualstudio\VsTestRunner.cs:line 711

Error happens only in one complicated project, with simple projects debugger starts and works properly.

Debugging in Visual Studio works ok.
I would appreciate a hint of the direction to look for possible solution.

Leave a Reply

Your email address will not be published. Required fields are marked *