-
Notifications
You must be signed in to change notification settings - Fork 106
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
Comments
Try removing all refs to the adapter and reinstalling |
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.
Any other steps I can take to troubleshoot this? |
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. |
Is it happening to everyone on your team or just some developers. |
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 thanks for updating. Glad it is working 👍 |
This worked for me when I ran into exactly the same problem today! Thank you for posting this solution here. |
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. |
Added to our Known Problems page. Thanks @lorenh for the solution. 👍 |
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: You can then clean all the caches by doing |
@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? |
It's been a pervasive problem for a long time now. https://xunit.github.io/docs/getting-started-desktop.html#run-tests-visualstudio |
Thanks @bradwilson, good to know. |
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
After
|
@MelaniaStewart Missing some images? |
@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. |
I am having the same issue. I tried clearing cache but the issue is still there.
When I build the tests I get this: |
@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/ |
@OsirisTerje Thank you for the comment. As you mentioned I have removed the 'NunitTestAdapter v2.1.1 and NUnitTestAdapter.WithFramework v2.0.0. |
@buddhika-don Looks like you need to run a NuGet Restore. The NUnit 3.9 package would cause the |
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:
This is what shows up in the output:
|
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. |
@rprouse Have we seen this one before? |
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...
|
I was able to solve the issue by simply setting |
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 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. |
I set my 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. |
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. |
@nateous |
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): 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. |
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. |
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! |
@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 ? |
You’re right
I didn’t install by myself, apparently I got it somehow.
Anyway this was the exact error I got and by removing the NuGet the issue was solved
Maybe you can add this to FAQ
ב-28 בינו׳ 2019, בשעה 10:33, Terje Sandstrom <[email protected]> כתב/ה:
… @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 ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@ybeapps That's interesting, I'll try to repro this. Do you mind telling me which version of the VSIX you have? |
I am still getting same error. and tried all above u guys said.
'dotnet.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.9\System.Private.CoreLib.dll'. Symbols loaded. |
@vatansoni89 Need some more information from you, version you're running of the adapter, VS version. Can you make a small repro and upload ? |
Is there an actual solution somewhere in this conversation?
-- Ran the NuGet Restore Packages |
|
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. |
The issues is still reproduced on Visual Studio 2013 and NUnit 3 Test Adapter 3.17.0 When I downgraded the adapter to 3.16.1, the issue disappeared So, my solution: Option #2: installation of the adapter as VS extension:
|
@askrinnik Can you upload a repro project for your case ? |
Please find attached the project. Thank you for the quick response |
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: |
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:
The text was updated successfully, but these errors were encountered: