Search code examples
c#xunit.net-6.0

Test fails in net6.0 with no info


So i started writing xunit test in net 6.0 with visual studio 2022 community preview.

Everything was working fine on the first PC.

But then when i set the dev environment on another PC (both windows 10) and i try running tests i get this :

========== Starting test run ==========
Testhost process exited with error: . Please check the diagnostic logs for more information.
Testhost process exited with error: . Please check the diagnostic logs for more information.
========== Test run aborted: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in < 1 ms ==========

With no more information. Where can i find those "diagnostic logs" i don't find info about it on the web.

I tried running tests manually in command terminal with "dotnet test" but i get this :

  **dotnet test
  Determining projects to restore...
  All projects are up-to-date for restore.
  kis-project-information-core -> D:\Users\Thomas MEDARD\Documents\Apollo\Kis\Booth\Libraries\kis-project-information\sources\binaries\net6.0\kis-project-information-core.dll
  kis-project-information-unit-tests -> D:\Users\Thomas MEDARD\Documents\Apollo\Kis\Booth\Libraries\kis-project-information\sources\binaries\net6.0\kis-project-information-unit-tests.dll
Test run for D:\Users\Thomas MEDARD\Documents\Apollo\Kis\Booth\Libraries\kis-project-information\sources\binaries\net6.0\kis-project-information-unit-tests.dll (.NETCoreApp,Version=v6.0)
Microsoft (R) Test Execution Command Line Tool Version 17.0.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Testhost process exited with error: . Please check the diagnostic logs for more information.

Test Run Aborted.**

I ran dotnet test -verbosity:diagnostic --diag:log.txt to see details and here is what i get

log.txt

log.host.21-11-30_10-19-44_26197_5.txt

So i see my test is detected but something is going wrong when running it


Solution

  • Ok so i found what is happening.

    After reinstalling i thought everything worked but actually i found the same problem again.

    What i realized is that i was in admin mode on my terminal. When i run the same command from non admin terminal, i get the problem explained.

    So my problem is accessing to dotnet. I guess it has something to do with having my source code stored in a different drive from dotnet.

    It's still weird that i can build without problem but testing need elevated privileges.