Skip to content
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

Closed
lorenh opened this issue Nov 10, 2016 · 53 comments
Closed

NUnit3TestDiscoverer unable to load nunit.engine #261

lorenh opened this issue Nov 10, 2016 · 53 comments

Comments

@lorenh
Copy link

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
Copy link
Contributor

CharliePoole commented Nov 10, 2016

Try removing all refs to the adapter and reinstalling

@lorenh
Copy link
Author

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
Copy link
Author

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
Copy link
Member

rprouse commented Nov 11, 2016

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

@lorenh
Copy link
Author

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 as completed Nov 11, 2016
@rprouse
Copy link
Member

rprouse commented Nov 11, 2016

@lorenh thanks for updating. Glad it is working 👍

@developerjake
Copy link

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

@rprouse
Copy link
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
Copy link
Member

rprouse commented Jan 25, 2018

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

@OsirisTerje
Copy link
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
Copy link
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
Copy link

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
Copy link
Member

rprouse commented Feb 1, 2018

Thanks @bradwilson, good to know.

@OsirisTerje OsirisTerje reopened this Feb 4, 2018
@MelaniaStewart
Copy link

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
Copy link
Member

@MelaniaStewart Missing some images?

@CharliePoole
Copy link
Contributor

@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
Copy link

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
Copy link
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/

@buddhika-don
Copy link

@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
Copy link
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
Copy link

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
Copy link

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
Copy link
Contributor

jnm2 commented Feb 25, 2018

@rprouse Have we seen this one before?

@peter-dolkens
Copy link

peter-dolkens 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
Copy link

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 .

@nateous
Copy link

nateous commented Jan 9, 2019

Just to throw in my experience with this issue.

I only started seeing this after attempting to fix an issue with date formatting between running tests locally with R# vs TeamCity.

Locally the ToShortDateString method would give me #/#/## format, but on TeamCity I would get #/#/### and the test would fail. I was testing some AutoMapper code that formatted a date.

I figured it was a CultureInfo issue, and so added some Threading CultureInfo code, but then I started to see this error.

Now I'm thinking this error might have something to do with setting CultureInfo, because I didn't have this issue before, and now I am getting it. If I revert my code back and get rid of any CultureInfo changes, this issue goes away.

I'll post my fix if I find one, but for now I'm thinking I'll just have to get rid of the DateTime format part of the mapping test (probably a bad idea anyways... sigh)

edit: I'm also using Parallels on Mac, because this is a Framework 4.5 project.

@nateous
Copy link

nateous commented Jan 9, 2019

I set my Default Processor Architecture but to no avail. Still gives me this error.

Also, I don't have the temp directory so I can't delete it. Perhaps this is a Mac/Parallels thing.

After removing my code I still can't get this to work again, it works sometimes, but then eventually fails again locally running tests.

Has anyone had any other fixes besides cache or processor setting? Perhaps my issue is cache but I can't find it yet. Again Parallels might be hiding this from me or it is just in another location.

@nateous
Copy link

nateous commented Jan 9, 2019

Another interesting note: Resharper test runner is what fails, but normal test runner works.

So perhaps I have an issue with there being two valid runners? I've always used the R# runner. Or at least tried to, but who knows.

@OsirisTerje
Copy link
Member

  1. There should be no issues with using two runners, resharper and VSTest should run fine side-by-side
  2. The Test Settings will only affect VSTest, not R#

@nateous
3: Can you upload a repro project?
4: Is what you're saying this works with Test Explorer (VSTest), but not with Resharper test runner ?
5. Does it work on command line ?

@OsirisTerje OsirisTerje added confirm We need a separate confirmation of this issue and removed VS Issue labels Jan 13, 2019
@nateous
Copy link

nateous commented Jan 13, 2019

There's no way I could repro this issue I think.

Here is what I did to resolve (which is what everyone does but get stuck at various points):
Uninstall all Nuget packages
Ensure all projects use same .Net version
Remove references to files (some weren't pointed at their Nuget packages)
Reinstall Nuget packages

I've seen issues like this before over the years and the errors change but the solution is always the same. Nuke everything and start from scratch. Especially on inherited projects with mountains of older Nuget packages.

If I can ever repro this specially I will certainly post!

Thanks for the reply! I was meaning to circle back but got lost in some other stuff.

@OsirisTerje
Copy link
Member

OsirisTerje commented Jan 13, 2019

Thanks! The "solution" you describe makes sense, I have seen the same. Projects that for one reason or another have got assembly references to the output files instead of to the correct packages, as you mention, is one nasty thing.
As far as I can see, the new project format using package references instead is the most elegant solution to this issue.
About the .net version, that is surely also something that can cause issues, there should be some more identifiable warning for this.
And, as you also mention, older nuget packages can be nasty. I think it is important to ensure projects that are "live", are being updated wrt to the packages. That is "code maintanence" :-)

@ybeapps
Copy link

ybeapps commented Jan 27, 2019

MY SOLUTION (January 2019!!)

I don't know if this is best practice, but it's the only solution that worked for me:

Remove NUnit3TestAdapter NuGet!
(Or at least downgrade from 3.12.0 to 3.10.0)
Tests run great without it

@OsirisTerje
Copy link
Member

@ybeapps If NUnit tests are running "great" without the nuget adapter, that means you have another instance of the adapter somewhere. Can it be you have installed the VSIX version ?

@ybeapps
Copy link

ybeapps commented Jan 29, 2019 via email

@OsirisTerje
Copy link
Member

@ybeapps That's interesting, I'll try to repro this. Do you mind telling me which version of the VSIX you have?
What we have seen earlier is that the VSIX takes precedence over the nuget, but that may have changed.
Is this VS 2017, latest update ?

@vatansoni89
Copy link

vatansoni89 commented Mar 26, 2019

I am still getting same error. and tried all above u guys said.

  1. nunit.engine.netstandard.dll'. Cannot find or open the PDB file.
  2. 'Mono.Cecil'. Cannot find or open the PDB file.

'dotnet.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Private.CoreLib.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\z003d4ks.nuget\packages\microsoft.testplatform.testhost\15.9.0\lib\netstandard1.5\testhost.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Runtime.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\z003d4ks.nuget\packages\microsoft.testplatform.objectmodel\15.9.0\lib\netstandard1.5\Microsoft.TestPlatform.CoreUtilities.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Diagnostics.Tracing.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Collections.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\z003d4ks.nuget\packages\microsoft.testplatform.objectmodel\15.9.0\lib\netstandard1.5\Microsoft.TestPlatform.PlatformAbstractions.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Runtime.Extensions.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Diagnostics.Debug.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Threading.Tasks.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Diagnostics.Process.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.ComponentModel.Primitives.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Globalization.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\z003d4ks.nuget\packages\microsoft.testplatform.testhost\15.9.0\lib\netstandard1.5\Microsoft.TestPlatform.CrossPlatEngine.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\z003d4ks.nuget\packages\microsoft.testplatform.testhost\15.9.0\lib\netstandard1.5\Microsoft.TestPlatform.CommunicationUtilities.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\z003d4ks.nuget\packages\microsoft.testplatform.objectmodel\15.9.0\lib\netstandard1.5\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\z003d4ks.nuget\packages\microsoft.testplatform.testhost\15.9.0\lib\netstandard1.5\Microsoft.VisualStudio.TestPlatform.Common.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\z003d4ks.nuget\packages\newtonsoft.json\12.0.1\lib\netstandard2.0\Newtonsoft.Json.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\netstandard.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Runtime.Serialization.Formatters.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Collections.Concurrent.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Diagnostics.TraceSource.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Threading.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Runtime.InteropServices.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Threading.ThreadPool.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Net.Primitives.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.IO.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Net.Sockets.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Threading.Overlapped.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Net.NameResolution.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Private.Uri.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\Microsoft.Win32.Primitives.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Text.Encoding.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Reflection.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Linq.Expressions.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.ComponentModel.TypeConverter.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Linq.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Runtime.Numerics.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Collections.Specialized.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Drawing.Primitives.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.ObjectModel.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Runtime.Serialization.Primitives.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Data.Common.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Xml.ReaderWriter.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Private.Xml.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.ComponentModel.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Reflection.Emit.ILGeneration.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Reflection.Primitives.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Reflection.Emit.Lightweight.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'Anonymously Hosted DynamicMethods Assembly'.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.IO.FileSystem.Primitives.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.IO.FileSystem.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Runtime.Loader.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'D:\Vatan\SiemensTFS\CloudServices\ClusterFit\ClusterFit_Main\ClusterFitUseCaseApi\Source\MFAController.UnitTests\bin\Debug\netcoreapp2.0\NUnit3.TestAdapter.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Reflection.TypeExtensions.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'D:\Vatan\SiemensTFS\CloudServices\ClusterFit\ClusterFit_Main\ClusterFitUseCaseApi\Source\MFAController.UnitTests\bin\Debug\netcoreapp2.0\nunit.engine.netstandard.dll'. Cannot find or open the PDB file.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Reflection.Extensions.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Threading.Timer.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Xml.XmlDocument.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Resources.ResourceManager.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Runtime.InteropServices.RuntimeInformation.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Reflection.Metadata.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Collections.Immutable.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Text.RegularExpressions.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\z003d4ks.nuget\packages\system.xml.xpath.xmldocument\4.3.0\lib\netstandard1.3\System.Xml.XPath.XmlDocument.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Xml.XPath.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'Mono.Cecil'. Cannot find or open the PDB file.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'D:\Vatan\SiemensTFS\CloudServices\ClusterFit\ClusterFit_Main\ClusterFitUseCaseApi\Source\MFAController.UnitTests\bin\Debug\netcoreapp2.0\ClusterFitUseCaseApi.UnitTests.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Users\z003d4ks.nuget\packages\nunit\3.11.0\lib\netstandard2.0\nunit.framework.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Console.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Text.Encoding.Extensions.dll'. Symbols loaded.
Exception thrown: 'System.Reflection.ReflectionTypeLoadException' in System.Private.CoreLib.dll
The thread 0x3504 has exited with code 0 (0x0).
The program '[13388] dotnet.exe: Program Trace' has exited with code 0 (0x0).
The program '[13388] dotnet.exe' has exited with code 0 (0x0).

@OsirisTerje
Copy link
Member

@vatansoni89 Need some more information from you, version you're running of the adapter, VS version. Can you make a small repro and upload ?

@BermudaLamb
Copy link

Is there an actual solution somewhere in this conversation?

Method 'get_TargetFramework' in type 'NUnit.Engine.Extensibility.ExtensionNode' from assembly 'nunit.engine, Version=3.7.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' does not have an implementation.

-- Ran the NuGet Restore Packages
-- VS Pro 2017 v15.9.10
-- Using ReSharper Ultimate v2018.3.4 to run the tests
-- NUnit v3.11.0 installed
-- NUnit3TestAdapter v3.13.0
-- NUnit.ConsoleRunner v.3.7.0
-- Don't have a %temp%\VisualStudioTestExplorerExtensions folder on my PC

@OsirisTerje
Copy link
Member

@BermudaLamb

  1. The VisualStudioTestExplorerExtensions folder issue has been fixed in later VS versions, so that is why you don't see this anymore.
  2. You don't need the consolerunner when you use the adapter.
  3. Ensure you don't have the VSIX installed, use the nuget adapter
  4. Follow the guidelines here: http://hermit.no/how-to-resolve-cases-of-visual-studio-no-tests-appearing/
  5. If you still have the issue, please upload a repro solution so we can have a look.

@OsirisTerje
Copy link
Member

This issue is about the earlier behavior with the solution described by @lorenh .

Please raise new issues for similar behavior, as they must have different root causes.

@OsirisTerje OsirisTerje added closed:done and removed confirm We need a separate confirmation of this issue labels Mar 30, 2019
@askrinnik
Copy link

askrinnik commented Aug 18, 2020

The issues is still reproduced on Visual Studio 2013 and NUnit 3 Test Adapter 3.17.0
Error message:
An exception occurred while test discoverer 'NUnit3TestDiscoverer' was loading tests. Exception: Object reference not set to an instance of an object. 
Test Explorer panel becomes empty

When I downgraded the adapter to 3.16.1, the issue disappeared

So, my solution:
Option #1: installation of the adapter to the project by nuget console command
Install-Package NUnit3TestAdapter -Version 3.16.1

Option #2: installation of the adapter as VS extension:

  1. Download the extension from the release page: https://github.com/nunit/nunit3-vs-adapter/releases/tag/V3.16.1
  2. Open Developer Command Prompt for VS and execute command
    VSIXInstaller.exe c:\Temp\\NUnit3TestAdapter-3.16.1.vsix

@OsirisTerje
Copy link
Member

@askrinnik Can you upload a repro project for your case ?

@askrinnik
Copy link

askrinnik commented Aug 18, 2020

@askrinnik Can you upload a repro project for your case ?

Please find attached the project.
UnitTestProject1.zip

Thank you for the quick response

@OsirisTerje
Copy link
Member

I see it works with VS2019.
image

I don't have VS2013 installed on any computer right now, nor any images. Using the nuget packages, I can't see any reason in your project for this to happen with VS 2013 either. There might be some left over from earlier versions, possibly in the VSTest cache (if you have used the VSIXes, which existed in VS2013. I suggest you try to clean that cache, using e.g. Ifix (using the mefcache option with -f to clean it) (check it like this:
image
or manually.

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

No branches or pull requests