New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUnit3TestDiscoverer unable to load nunit.engine #261

Open
lorenh opened this Issue Nov 10, 2016 · 34 comments

Comments

Projects
None yet
@lorenh

lorenh commented Nov 10, 2016

I just upgraded to the 3.5.1 NuGet version of the adapter, and now my test output shows this. What am I doing wrong?

------ Discover test started ------
An exception occurred while test discoverer 'NUnit3TestDiscoverer' was loading tests. Exception: Could not load file or assembly 'nunit.engine, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The system cannot find the file specified.
========== Discover test finished: 0 found (0:00:01.74) ==========

Here are the NUnit related NuGet packages I have installed:

@CharliePoole

This comment has been minimized.

Show comment
Hide comment
@CharliePoole

CharliePoole Nov 10, 2016

Member

Try removing all refs to the adapter and reinstalling

Member

CharliePoole commented Nov 10, 2016

Try removing all refs to the adapter and reinstalling

@lorenh

This comment has been minimized.

Show comment
Hide comment
@lorenh

lorenh Nov 11, 2016

Didn't make any difference. Any other ideas? The only reference to anything NUnit related in the test project file is to the nunit.framework. In the previous version of the adapter I seem to remember a whole bunch of Mono.Cecil.* references and a reference to the NUnit3.TestAdapter itself. I was happy to see those go, but not happy to see it stop working.

<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
  <HintPath>..\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll</HintPath>
  <Private>True</Private>
</Reference>

Any other steps I can take to troubleshoot this?

lorenh commented Nov 11, 2016

Didn't make any difference. Any other ideas? The only reference to anything NUnit related in the test project file is to the nunit.framework. In the previous version of the adapter I seem to remember a whole bunch of Mono.Cecil.* references and a reference to the NUnit3.TestAdapter itself. I was happy to see those go, but not happy to see it stop working.

<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
  <HintPath>..\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll</HintPath>
  <Private>True</Private>
</Reference>

Any other steps I can take to troubleshoot this?

@lorenh

This comment has been minimized.

Show comment
Hide comment
@lorenh

lorenh Nov 11, 2016

A little more information. I installed the .vsix version and it works, so at least we have a workaround, but it's not ideal because everyone on the team will have to install it. That was one of the things we liked about the NuGet version.

lorenh commented Nov 11, 2016

A little more information. I installed the .vsix version and it works, so at least we have a workaround, but it's not ideal because everyone on the team will have to install it. That was one of the things we liked about the NuGet version.

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Nov 11, 2016

Member

Is it happening to everyone on your team or just some developers.

Member

rprouse commented Nov 11, 2016

Is it happening to everyone on your team or just some developers.

@lorenh

This comment has been minimized.

Show comment
Hide comment
@lorenh

lorenh Nov 11, 2016

I found the issue. I had to close Visual Studio, delete a cache folder named NUnit3TestAdapter.3.5.1 under my profile which looks like it had incomplete files in it. Then I relaunched Visual Studio and now all is right with the world. Here's the full path to the folder:

C:\Users\username\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnit3TestAdapter.3.5.1

(found it thanks to Process Monitor, one of my favorite all-time troubleshooting tools)

Impressed with the responsiveness of the devs! Thanks, and sorry for the false alarm.

Hope this helps in case anyone else gets themselves into this state.

lorenh commented Nov 11, 2016

I found the issue. I had to close Visual Studio, delete a cache folder named NUnit3TestAdapter.3.5.1 under my profile which looks like it had incomplete files in it. Then I relaunched Visual Studio and now all is right with the world. Here's the full path to the folder:

C:\Users\username\AppData\Local\Temp\VisualStudioTestExplorerExtensions\NUnit3TestAdapter.3.5.1

(found it thanks to Process Monitor, one of my favorite all-time troubleshooting tools)

Impressed with the responsiveness of the devs! Thanks, and sorry for the false alarm.

Hope this helps in case anyone else gets themselves into this state.

@lorenh lorenh closed this Nov 11, 2016

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Nov 11, 2016

Member

@lorenh thanks for updating. Glad it is working 👍

Member

rprouse commented Nov 11, 2016

@lorenh thanks for updating. Glad it is working 👍

@developerjake

This comment has been minimized.

Show comment
Hide comment
@developerjake

developerjake Jan 21, 2018

This worked for me when I ran into exactly the same problem today! Thank you for posting this solution here.

developerjake commented Jan 21, 2018

This worked for me when I ran into exactly the same problem today! Thank you for posting this solution here.

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Jan 25, 2018

Member

Wow, huge number of Thumbs Up and Hearts on your answer @lorenh. We should add this to our FAQ if this many people are running into the problem.

Member

rprouse commented Jan 25, 2018

Wow, huge number of Thumbs Up and Hearts on your answer @lorenh. We should add this to our FAQ if this many people are running into the problem.

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Jan 25, 2018

Member

Added to our Known Problems page. Thanks @lorenh for the solution. 👍

Member

rprouse commented Jan 25, 2018

Added to our Known Problems page. Thanks @lorenh for the solution. 👍

@OsirisTerje

This comment has been minimized.

Show comment
Hide comment
@OsirisTerje

OsirisTerje Jan 25, 2018

Member

I wrote a blogpost on the different ways things can go wrong, including this issue, with due credit to @lorenh of course :-) I have also added it as an option to IFix , so you can do:
IFix vstestcache
to check where they are, and if the corruption can be detected
image

You can then clean all the caches by doing
IFix vstestcache -f
image

Member

OsirisTerje commented Jan 25, 2018

I wrote a blogpost on the different ways things can go wrong, including this issue, with due credit to @lorenh of course :-) I have also added it as an option to IFix , so you can do:
IFix vstestcache
to check where they are, and if the corruption can be detected
image

You can then clean all the caches by doing
IFix vstestcache -f
image

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Jan 31, 2018

Member

@OsirisTerje I am going to reopen this and mark as a Visual Studio issue so that it is easily discoverable.

Curious, @bradwilson are you seeing issues with the xUnit adapter failing because of corrupt cached copies in the recent releases of Visual Studio?

Member

rprouse commented Jan 31, 2018

@OsirisTerje I am going to reopen this and mark as a Visual Studio issue so that it is easily discoverable.

Curious, @bradwilson are you seeing issues with the xUnit adapter failing because of corrupt cached copies in the recent releases of Visual Studio?

@bradwilson

This comment has been minimized.

Show comment
Hide comment
@bradwilson

bradwilson commented Jan 31, 2018

It's been a pervasive problem for a long time now.

https://xunit.github.io/docs/getting-started-desktop.html#run-tests-visualstudio

image

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Feb 1, 2018

Member

Thanks @bradwilson, good to know.

Member

rprouse commented Feb 1, 2018

Thanks @bradwilson, good to know.

@OsirisTerje OsirisTerje reopened this Feb 4, 2018

@MelaniaStewart

This comment has been minimized.

Show comment
Hide comment
@MelaniaStewart

MelaniaStewart Feb 6, 2018

I had this issue and I tried removing the cached file, reloading nunit. VS will ignore all my nunit test. I compared an old project file to the one that didn't work. I finally found the problem - The packages.config was not getting updated and I had the old MSTest packages
BEFORE

<packages>
  <package id="MSTest.TestAdapter" version="1.2.0" targetFramework="net461" />
  <package id="MSTest.TestFramework" version="1.2.0" targetFramework="net461" />
  <package id="NUnit" version="3.8.1" targetFramework="net461" />
</packages>

After

<packages>
  <package id="NUnit" version="3.8.1" targetFramework="net461" />
  <package id="NUnit3TestAdapter" version="3.8.0" targetFramework="net461" />
</packages>

MelaniaStewart commented Feb 6, 2018

I had this issue and I tried removing the cached file, reloading nunit. VS will ignore all my nunit test. I compared an old project file to the one that didn't work. I finally found the problem - The packages.config was not getting updated and I had the old MSTest packages
BEFORE

<packages>
  <package id="MSTest.TestAdapter" version="1.2.0" targetFramework="net461" />
  <package id="MSTest.TestFramework" version="1.2.0" targetFramework="net461" />
  <package id="NUnit" version="3.8.1" targetFramework="net461" />
</packages>

After

<packages>
  <package id="NUnit" version="3.8.1" targetFramework="net461" />
  <package id="NUnit3TestAdapter" version="3.8.0" targetFramework="net461" />
</packages>
@OsirisTerje

This comment has been minimized.

Show comment
Hide comment
@OsirisTerje

OsirisTerje Feb 6, 2018

Member

@MelaniaStewart Missing some images?

Member

OsirisTerje commented Feb 6, 2018

@MelaniaStewart Missing some images?

@CharliePoole

This comment has been minimized.

Show comment
Hide comment
@CharliePoole

CharliePoole Feb 6, 2018

Member

@MelaniaStewart I updated your message to add backtick "fences" so the html would display. You can edit the message to see what's needed in such cases.

Member

CharliePoole commented Feb 6, 2018

@MelaniaStewart I updated your message to add backtick "fences" so the html would display. You can edit the message to see what's needed in such cases.

@buddhika-don

This comment has been minimized.

Show comment
Hide comment
@buddhika-don

buddhika-don Feb 21, 2018

I am having the same issue. I tried clearing cache but the issue is still there.

<?xml version="1.0" encoding="utf-8"?> <packages> <package id="ExcelDataReader" version="2.1.2.3" targetFramework="net45" /> <package id="Microsoft.Web.Xdt" version="2.1.1" targetFramework="net45" /> <package id="Newtonsoft.Json" version="11.0.1-beta3" targetFramework="net45" /> <package id="NuGet.Core" version="2.14.0" targetFramework="net45" /> <package id="NuGet.VisualStudio" version="4.5.0" targetFramework="net45" /> <package id="NUnit" version="3.9.0" targetFramework="net45" /> <package id="NUnit.ConsoleRunner" version="3.8.0" targetFramework="net45" /> <package id="NUnit.Extension.NUnitProjectLoader" version="3.6.0" targetFramework="net45" /> <package id="NUnit.Extension.NUnitV2Driver" version="3.7.0" targetFramework="net45" /> <package id="NUnit.Extension.NUnitV2ResultWriter" version="3.6.0" targetFramework="net45" /> <package id="NUnit.Extension.TeamCityEventListener" version="1.0.3" targetFramework="net45" /> <package id="NUnit.Extension.VSProjectLoader" version="3.7.0" targetFramework="net45" /> <package id="NUnit.Runners" version="3.8.0" targetFramework="net45" /> <package id="NUnit3TestAdapter" version="3.9.0" targetFramework="net45" /> <package id="NUnitTestAdapter.WithFramework" version="2.0.0" targetFramework="net45" /> <package id="Selenium.Chrome.WebDriver" version="2.33" targetFramework="net45" /> <package id="Selenium.Firefox.WebDriver" version="0.19.1" targetFramework="net45" /> <package id="Selenium.Support" version="3.8.0" targetFramework="net45" /> <package id="Selenium.WebDriver" version="3.8.0" targetFramework="net45" /> <package id="Selenium.WebDriver.ChromeDriver" version="2.35.0" targetFramework="net45" /> <package id="Selenium.WebDriver.IEDriver64" version="3.3.0.1" targetFramework="net45" /> <package id="Selenium.WebDriverBackedSelenium" version="3.8.0" targetFramework="net45" /> <package id="SharpZipLib" version="0.86.0" targetFramework="net45" /> <package id="SpecFlow" version="2.3.0" targetFramework="net45" /> <package id="SpecFlow.MsTest" version="2.3.0" targetFramework="net45" /> <package id="SpecFlow.NUnit" version="2.3.0" targetFramework="net45" /> <package id="System.ValueTuple" version="4.3.0" targetFramework="net45" /> <package id="WebDriverIEDriver" version="2.45.0.0" targetFramework="net45" />

When I build the tests I get this:
1>------ Build started: Project: Automation, Configuration: Debug Any CPU ------ 1> Feeds used: 1> https://api.nuget.org/v3/index.json 1> 1> All packages listed in C:\Repos\eCommerce-Automation\Framework\packages.Config are already installed. 1> Automation -> C:\Repos\eCommerce-Automation\Framework\bin\Debug\Framework.dll ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

buddhika-don commented Feb 21, 2018

I am having the same issue. I tried clearing cache but the issue is still there.

<?xml version="1.0" encoding="utf-8"?> <packages> <package id="ExcelDataReader" version="2.1.2.3" targetFramework="net45" /> <package id="Microsoft.Web.Xdt" version="2.1.1" targetFramework="net45" /> <package id="Newtonsoft.Json" version="11.0.1-beta3" targetFramework="net45" /> <package id="NuGet.Core" version="2.14.0" targetFramework="net45" /> <package id="NuGet.VisualStudio" version="4.5.0" targetFramework="net45" /> <package id="NUnit" version="3.9.0" targetFramework="net45" /> <package id="NUnit.ConsoleRunner" version="3.8.0" targetFramework="net45" /> <package id="NUnit.Extension.NUnitProjectLoader" version="3.6.0" targetFramework="net45" /> <package id="NUnit.Extension.NUnitV2Driver" version="3.7.0" targetFramework="net45" /> <package id="NUnit.Extension.NUnitV2ResultWriter" version="3.6.0" targetFramework="net45" /> <package id="NUnit.Extension.TeamCityEventListener" version="1.0.3" targetFramework="net45" /> <package id="NUnit.Extension.VSProjectLoader" version="3.7.0" targetFramework="net45" /> <package id="NUnit.Runners" version="3.8.0" targetFramework="net45" /> <package id="NUnit3TestAdapter" version="3.9.0" targetFramework="net45" /> <package id="NUnitTestAdapter.WithFramework" version="2.0.0" targetFramework="net45" /> <package id="Selenium.Chrome.WebDriver" version="2.33" targetFramework="net45" /> <package id="Selenium.Firefox.WebDriver" version="0.19.1" targetFramework="net45" /> <package id="Selenium.Support" version="3.8.0" targetFramework="net45" /> <package id="Selenium.WebDriver" version="3.8.0" targetFramework="net45" /> <package id="Selenium.WebDriver.ChromeDriver" version="2.35.0" targetFramework="net45" /> <package id="Selenium.WebDriver.IEDriver64" version="3.3.0.1" targetFramework="net45" /> <package id="Selenium.WebDriverBackedSelenium" version="3.8.0" targetFramework="net45" /> <package id="SharpZipLib" version="0.86.0" targetFramework="net45" /> <package id="SpecFlow" version="2.3.0" targetFramework="net45" /> <package id="SpecFlow.MsTest" version="2.3.0" targetFramework="net45" /> <package id="SpecFlow.NUnit" version="2.3.0" targetFramework="net45" /> <package id="System.ValueTuple" version="4.3.0" targetFramework="net45" /> <package id="WebDriverIEDriver" version="2.45.0.0" targetFramework="net45" />

When I build the tests I get this:
1>------ Build started: Project: Automation, Configuration: Debug Any CPU ------ 1> Feeds used: 1> https://api.nuget.org/v3/index.json 1> 1> All packages listed in C:\Repos\eCommerce-Automation\Framework\packages.Config are already installed. 1> Automation -> C:\Repos\eCommerce-Automation\Framework\bin\Debug\Framework.dll ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

@OsirisTerje

This comment has been minimized.

Show comment
Hide comment
@OsirisTerje

OsirisTerje Feb 22, 2018

Member

@buddhika-don Your tests are using NUnit3 and your adapter is NUnit2. Can you try to use the NUNit3 test adapter ? https://www.nuget.org/packages/NUnit3TestAdapter/

Member

OsirisTerje commented Feb 22, 2018

@buddhika-don Your tests are using NUnit3 and your adapter is NUnit2. Can you try to use the NUNit3 test adapter ? https://www.nuget.org/packages/NUnit3TestAdapter/

@buddhika-don

This comment has been minimized.

Show comment
Hide comment
@buddhika-don

buddhika-don Feb 22, 2018

@OsirisTerje Thank you for the comment. As you mentioned I have removed the 'NunitTestAdapter v2.1.1 and NUnitTestAdapter.WithFramework v2.0.0.
image

but I am getting few errors now:
image

buddhika-don commented Feb 22, 2018

@OsirisTerje Thank you for the comment. As you mentioned I have removed the 'NunitTestAdapter v2.1.1 and NUnitTestAdapter.WithFramework v2.0.0.
image

but I am getting few errors now:
image

@jnm2

This comment has been minimized.

Show comment
Hide comment
@jnm2

jnm2 Feb 23, 2018

Contributor

@buddhika-don Looks like you need to run a NuGet Restore. The NUnit 3.9 package would cause the NUnit.Framework and Test references to start working.

Contributor

jnm2 commented Feb 23, 2018

@buddhika-don Looks like you need to run a NuGet Restore. The NUnit 3.9 package would cause the NUnit.Framework and Test references to start working.

@JasonBock

This comment has been minimized.

Show comment
Hide comment
@JasonBock

JasonBock Feb 25, 2018

Hey, just to throw this out there, I'm getting this error with a project I'm playing with right now. Very simple project, only has one test. Here's the .csproj file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net471</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
    <PackageReference Include="NUnit" Version="3.9.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
  </ItemGroup>

</Project>

This is what shows up in the output:

[2/24/2018 9:54:41 PM Informational] ------ Discover test started ------
[2/24/2018 9:54:42 PM Error] An exception occurred while test discoverer 'NUnit3TestDiscoverer' was loading tests. Exception: Could not load file or assembly 'nunit.engine, Version=3.7.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The system cannot find the file specified.
[2/24/2018 9:54:42 PM Informational] ========== Discover test finished: 0 found (0:00:00.3864777) ==========

JasonBock commented Feb 25, 2018

Hey, just to throw this out there, I'm getting this error with a project I'm playing with right now. Very simple project, only has one test. Here's the .csproj file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net471</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
    <PackageReference Include="NUnit" Version="3.9.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
  </ItemGroup>

</Project>

This is what shows up in the output:

[2/24/2018 9:54:41 PM Informational] ------ Discover test started ------
[2/24/2018 9:54:42 PM Error] An exception occurred while test discoverer 'NUnit3TestDiscoverer' was loading tests. Exception: Could not load file or assembly 'nunit.engine, Version=3.7.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The system cannot find the file specified.
[2/24/2018 9:54:42 PM Informational] ========== Discover test finished: 0 found (0:00:00.3864777) ==========
@JasonBock

This comment has been minimized.

Show comment
Hide comment
@JasonBock

JasonBock Feb 25, 2018

After playing with things more tonight, I still am getting the issue, but it seems to only happen if I have a combination of .NET Core and .NET Framework test projects in my solution. If I have one .NET Framework test project (using the old or new .csproj file format, doesn't matter), it works. But as soon as I add in a .NET Core project and try to run all tests, I always get this nunit.engine error.

JasonBock commented Feb 25, 2018

After playing with things more tonight, I still am getting the issue, but it seems to only happen if I have a combination of .NET Core and .NET Framework test projects in my solution. If I have one .NET Framework test project (using the old or new .csproj file format, doesn't matter), it works. But as soon as I add in a .NET Core project and try to run all tests, I always get this nunit.engine error.

@jnm2

This comment has been minimized.

Show comment
Hide comment
@jnm2

jnm2 Feb 25, 2018

Contributor

@rprouse Have we seen this one before?

Contributor

jnm2 commented Feb 25, 2018

@rprouse Have we seen this one before?

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Feb 25, 2018

Member

@jnm2 no. I wonder if recent versions of VS have started to reuse the test runner process for .NET Core and Framework? @JasonBock are you running the latest 15.5 or even 15.6 preview?

Member

rprouse commented Feb 25, 2018

@jnm2 no. I wonder if recent versions of VS have started to reuse the test runner process for .NET Core and Framework? @JasonBock are you running the latest 15.5 or even 15.6 preview?

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Feb 26, 2018

Member

@JasonBock I am unable to reproduce with Visual Studio 15.5.6 and two projects targeting netcoreapp2.0 and net47. My repo is at https://github.com/rprouse/NUnitMultiTargetTests

I did get a different error in my net47 target because I had to switch the debug type to full because the older version of Mono.Cecil that is used for the full framework doesn't recognize the newer PDB format. My csproj file looks like this,

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net47</TargetFramework>
    <DebugType>Full</DebugType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
    <PackageReference Include="NUnit" Version="3.9.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
  </ItemGroup>

</Project>

I am going to install the 4.7.1 target and update to 15.5.7 to see if that makes a difference. If you are running 15.6, can you try my repo? I would prefer not to install it if I can help it 😄

Member

rprouse commented Feb 26, 2018

@JasonBock I am unable to reproduce with Visual Studio 15.5.6 and two projects targeting netcoreapp2.0 and net47. My repo is at https://github.com/rprouse/NUnitMultiTargetTests

I did get a different error in my net47 target because I had to switch the debug type to full because the older version of Mono.Cecil that is used for the full framework doesn't recognize the newer PDB format. My csproj file looks like this,

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net47</TargetFramework>
    <DebugType>Full</DebugType>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
    <PackageReference Include="NUnit" Version="3.9.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
  </ItemGroup>

</Project>

I am going to install the 4.7.1 target and update to 15.5.7 to see if that makes a difference. If you are running 15.6, can you try my repo? I would prefer not to install it if I can help it 😄

@rprouse

This comment has been minimized.

Show comment
Hide comment
@rprouse

rprouse Feb 26, 2018

Member

Still no repro with net471 or with Visual Studio 15.5.7,

image

Member

rprouse commented Feb 26, 2018

Still no repro with net471 or with Visual Studio 15.5.7,

image

@JasonBock

This comment has been minimized.

Show comment
Hide comment
@JasonBock

JasonBock Feb 26, 2018

I have 15.5.6

JasonBock commented Feb 26, 2018

I have 15.5.6

@jnm2

This comment has been minimized.

Show comment
Hide comment
@jnm2

jnm2 Feb 26, 2018

Contributor

@JasonBock You're probably going to have to cut down the solution to find a minimal repro, if Rob's guess at your setup doesn't cause the repro on your machine.

Contributor

jnm2 commented Feb 26, 2018

@JasonBock You're probably going to have to cut down the solution to find a minimal repro, if Rob's guess at your setup doesn't cause the repro on your machine.

@JasonBock

This comment has been minimized.

Show comment
Hide comment
@JasonBock

JasonBock Feb 26, 2018

@rprouse your repo works on my machine. I'm not sure what the difference is. I tried redoing my project and now things are working. I'm not sure what was causing the error last night. It was happening, and I don't think it's the <DebugType> value, because if I remove that now, I get a vastly different error.

So....I guess it's not an issue then.

JasonBock commented Feb 26, 2018

@rprouse your repo works on my machine. I'm not sure what the difference is. I tried redoing my project and now things are working. I'm not sure what was causing the error last night. It was happening, and I don't think it's the <DebugType> value, because if I remove that now, I get a vastly different error.

So....I guess it's not an issue then.

@OsirisTerje

This comment has been minimized.

Show comment
Hide comment
@OsirisTerje

OsirisTerje Feb 26, 2018

Member

@JasonBock Did you check (or delete) the vstest cache?

Member

OsirisTerje commented Feb 26, 2018

@JasonBock Did you check (or delete) the vstest cache?

@replaysMike

This comment has been minimized.

Show comment
Hide comment
@replaysMike

replaysMike Apr 21, 2018

I too am having this issue. My project is full of Standard 2.0 and .net Core 2.1 projects and using VS2017 Preview 3. Some test projects actually run the nunit tests, but others don't. Even the ones that do run throw the same error in Test output (despite running!):

System.IO.FileNotFoundException: Unable to find tests for C:\...\Project.Tests.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate. Rerun with /diag option to diagnose further.

replaysMike commented Apr 21, 2018

I too am having this issue. My project is full of Standard 2.0 and .net Core 2.1 projects and using VS2017 Preview 3. Some test projects actually run the nunit tests, but others don't. Even the ones that do run throw the same error in Test output (despite running!):

System.IO.FileNotFoundException: Unable to find tests for C:\...\Project.Tests.dll. Make sure test project has a nuget reference of package "Microsoft.NET.Test.Sdk" and framework version settings are appropriate. Rerun with /diag option to diagnose further.
@OsirisTerje

This comment has been minimized.

Show comment
Hide comment
@OsirisTerje

OsirisTerje Apr 22, 2018

Member

@replaysMike Are you able to extract a repro ?

Member

OsirisTerje commented Apr 22, 2018

@replaysMike Are you able to extract a repro ?

@dolkensp

This comment has been minimized.

Show comment
Hide comment
@dolkensp

dolkensp Jun 18, 2018

I'm seeing this issue manifesting in live during assembly discovery.

It surprised me, as I wasn't expecting to see any references to the test adapter assembly, yet there they were...

[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0
   System.Reflection.Assembly.GetTypes() +112
*censored*

[Exception: Error loading types from `NUnit3.TestAdapter, Version=3.10.0.21, Culture=neutral, PublicKeyToken=4cb40d35494691ac`.

Loader Exceptions: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.]
*censored*

[HttpException (0x80004005): Error loading types from `NUnit3.TestAdapter, Version=3.10.0.21, Culture=neutral, PublicKeyToken=4cb40d35494691ac`.

Loader Exceptions: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +521
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +185
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +418
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Error loading types from `NUnit3.TestAdapter, Version=3.10.0.21, Culture=neutral, PublicKeyToken=4cb40d35494691ac`.

Loader Exceptions: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +534
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +718

dolkensp commented Jun 18, 2018

I'm seeing this issue manifesting in live during assembly discovery.

It surprised me, as I wasn't expecting to see any references to the test adapter assembly, yet there they were...

[ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.]
   System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) +0
   System.Reflection.Assembly.GetTypes() +112
*censored*

[Exception: Error loading types from `NUnit3.TestAdapter, Version=3.10.0.21, Culture=neutral, PublicKeyToken=4cb40d35494691ac`.

Loader Exceptions: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.]
*censored*

[HttpException (0x80004005): Error loading types from `NUnit3.TestAdapter, Version=3.10.0.21, Culture=neutral, PublicKeyToken=4cb40d35494691ac`.

Loader Exceptions: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +521
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +185
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +418
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): Error loading types from `NUnit3.TestAdapter, Version=3.10.0.21, Culture=neutral, PublicKeyToken=4cb40d35494691ac`.

Loader Exceptions: Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified., Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +534
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +718
@rbvictor

This comment has been minimized.

Show comment
Hide comment
@rbvictor

rbvictor Aug 23, 2018

I was able to solve the issue by simply setting Test > Test Settings > Default Processor Architecture > X64 on Visual Studio as suggested in https://stackoverflow.com/questions/38734045/nunit-failed-to-load-dll#tab-top .

rbvictor commented Aug 23, 2018

I was able to solve the issue by simply setting Test > Test Settings > Default Processor Architecture > X64 on Visual Studio as suggested in https://stackoverflow.com/questions/38734045/nunit-failed-to-load-dll#tab-top .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment