-
Notifications
You must be signed in to change notification settings - Fork 152
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
NUnit Engine 3.15.0 cannot load the test assembly #1180
Comments
This is the same as nunit/nunit-v2-framework-driver#51 with the added detail that your code works under 3.14.0. I closed the first issue as "not a bug" for reasons I explained there but I'll keep this one open for a while because I think the question of why it worked before is kind of interesting. First, some questions for you...
|
Hey @CharliePoole, thank you for detailed answers for both questions. Basically I'm trying to automate both NUnit 2 and 3 tests. Based on your answers I realized I can achieve that easily with nunit3-console, I missed this option before :) Thanks a lot for helping me to wrap my head about this. Therefore this issue is not relevant for me but still interesting so here comes my answer: There is no extension referenced in this case (here I'm only trying to run NUnit3 tests) and I only reference NUnit.Engine. If I run the same code with NUnit.Engine 3.14.0, everything works fine. However with NUnit.Engine 3.15.0, I get the exception. The output is the same for both cases, apart from different versions of nunit.engine.api.dll, nunit.engine.core.dll and nunit.engine.dll. |
Hi @nataliaheliova and @CharliePoole , I'm facing the same issue when using NUnit.Engine 3.15.X from a .net60 console application. I've drilled it down to the fact that package version 3.14 of the engine still contained the assemblies for .netcoreapp31 but those were removed from 3.15 only leaving netstandard20 to use for a project targeting .net60. Therefore the NUnitNetStandardDriver is used and not the NUnitNetCore31Driver. NUnitNetStandardDriver is unable to load any assemblies that are not in the Default AppDomain's base directory or probing paths. Therefore it is impossible to load a test assembly from anywhere else. Why have the .netcoreapp31 binaries been removed from NUnit.Engine 3.15 and newer? NUnitNetCore31Driver uses it's own AssemblyLoadContext and is able to load test assemblies from any path. |
I've left this issue inactive after @nataliaheliova 's last comment, but if it remains an actual problem for you, we can try to work it out. The NUnitNetCore31Driver was removed because we were able to simplify the code without breaking any tests. So we'll need to investigate how you are calling the engine from your own code and how that differs from what the console runner is doing. Can you add some more info about what you are doing in your code? Also, have you tried running your test assembly under the console runner? |
@CharliePoole I've tried running it with the .net60 build of nunit3-console (3.15.2) and this uses NUnitNetCore31Driver internally (and therefore, this works). This is why I am surprised it's not in the engine package any more. What I am doing in my code: I have a custom test runner built initially on .Net Framework which I am migrating currently to .net6. That runner has some special handling and selection / filtering logic for SpecFlow scenarios and also creates custom reports. For me it seems like NUnitNetCore31Driver should be part of the NUnit.Engine package again because it is also used by nunit3-console. |
Hang on a minute! Are we talking about The former runs under .NET Framework, but launches separate processes for the tests. The latter runs under .NET 6.0 and only runs tests in process. The reasons for this are historical - plus we are in transition toward 4.0. |
@CharliePoole So I would say this is a .net6 build of nunit3-console, which does not run under .NET Framework. Am I missing something? |
@cyclox The NUnit.Console package contains no software at all. It only references a set of other packages, including the main one, NUnit.ConsoleRunner. The NUnit.ConsoleRunner package has a net20 directory and various agent directories. Directory agent/net6.0 exists, but doesn't contain a copy of nunit3-console.exe, only the agent exes. Suggestion... take the package you are actually using and temporarily change the extension from .nupkg to .zip. Then you can unzip it and see what's there. |
Hi @CharliePoole , thanks for taking your time with me. I was totally on the wrong path. Sorry for that. I had actually downloaded the .zip distribution of this NUnit.Console release from the GitHub Releases page, not the .nupkg file: https://github.com/nunit/nunit-console/releases/tag/3.15.2 When I use the nuget package I hope that clarifies my problem. So either I need to go with the AssemblyResolve workaround and hope this doesn't break anything or I'll need to build the NUnit.Engine version for Thanks for your patience! |
@Cylox OK, that clears up one bit at least. Before going further, I'm going to review the last few versions for consistency to make sure there wasn't a packaging error. I'll be back. |
Not sure I’m supposed to be on this thread.
…On Thu, Aug 4, 2022 at 8:40 AM CharliePoole ***@***.***> wrote:
@Cylox <https://github.com/Cylox> OK, that clears up one bit at least.
Before going further, I'm going to review the last few versions for
consistency to make sure there wasn't a packaging error. I'll be back.
—
Reply to this email directly, view it on GitHub
<#1180 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANE47RUD4HVZNQPHKBCM35TVXPP6BANCNFSM5THDOLLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@cyclox Apparently github handles are case-sensitive. I'll be more careful. :-) |
No worries. Take care.
…On Thu, Aug 4, 2022 at 9:06 AM CharliePoole ***@***.***> wrote:
@cyclox <https://github.com/cyclox> Apparently github handles are
case-sensitive. I'll be more careful. :-)
—
Reply to this email directly, view it on GitHub
<#1180 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANE47RW3WSS55RXCNXTKYULVXPS6XANCNFSM5THDOLLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Looking at the contents of the zip package, I can see that it's a bit confusing. There are two completely different executable applications included with the same name, one under net20 and one under net6.0, whereas if you use nuget, there are two entirely different packages. Longer term, I think I need to change this. |
You’ve reached @cyclox not @Cylox. I’m beginning to think that I might need
to start using nunit. ;)
…On Sat, Sep 24, 2022 at 9:00 AM CharliePoole ***@***.***> wrote:
@Cylox <https://github.com/Cylox> See issue #1225
<#1225>
—
Reply to this email directly, view it on GitHub
<#1180 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANE47RXDICBFU7RKVCMXJJTV74QRLANCNFSM5THDOLLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@cyclox I think you're being notified because you were previously in the discussion due to my mistake. You'll have to unsubscribe from it. |
Ah ok. Best of luck with these bug fixes.
…On Sat, Sep 24, 2022 at 12:30 PM CharliePoole ***@***.***> wrote:
@cyclox <https://github.com/cyclox> I think you're being notified because
you were previously in the discussion due to my mistake. You'll have to
unsubscribe from it.
—
Reply to this email directly, view it on GitHub
<#1180 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANE47RSPSCKSOS7YR3JVNJLV75JF5ANCNFSM5THDOLLQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Closing this since #1225 restored netcoreapp3.1 build of the engine. |
This issue has been resolved in version 3.16.0 The release is available on: |
Hey there,
I have a .NET 6.0 console project which references NUnit.Engine 3.15.0. When I try to run the tests from test assembly (targeting .NET 6.0, referencing NUnit 3.13.3), I get the following exception:
The same works flawlessly when I downgrade to NUnit Engine 3.14.0. Is there any reason why this would not work with the latest NUnit Engine?
Please find attached solution which can be used to reproduce the issue.
NUnit3_Repro.zip
The text was updated successfully, but these errors were encountered: