-
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
Exception when targeting .NET Framework with .NET 7 installed #1176
Comments
This issue should probably be moved to https://github.com/nunit/nunit-console repo. Sorry for it that I didn't find that repo before. |
@YuhanKun Thanks for reporting this. I transferred the issue, as you see. |
This is affecting me as well (see linked duplicate issue). |
Unless you need something specific from the .net 7 sdk, can you create a global.json file on your project limiting the sdk used for your net4x project to 6 or lower? I also installed the net7 sdk but had no problem running tests in my existing repositories. |
@manfred-brands it feels like there ought to be a fix here given that the error is failing to parse in NUnit itself. Why shouldn't NUnit work with the net7.0 SDK? |
@madelson The PR to fix this issue (#1175) has been merged. Are you having a different problem than what's fixed there? Have you tried out the latest dev release on our myget feed? That said, I see from #4085 that you actually ran into the problem using the NUnit 3 Visual Studio adapter. The adapter bundles its own copy of the NUnit engine, which is normally the latest release version at the time the adapter is released. Consequently, nothing we fix in the engine (which is where the problem lies) will be reflected in the adapter. @OsirisTerje any thoughts on how we should deal with this? |
My suggested trick with NUnitEngine does call |
@manfred-brands The engine is intended to work in different environments. In some cases (like a GUI) it may be called on to load different assemblies at different times, requiring differnt frameworks. So it needs to know what frameworks are avaiable and does that at the time it is initialized. At the specific point where we are throwing an exception, we could, conceivably not throw it. However, now that 7.0 is fixed, I think we have time to do better than that. The error occurs when we are determining the CLR version of the framework. I wonder if we really need to know that for any framework beyond 4.x. The call is only made to Runtime.cs to populate the ClrVersion property. What code uses that? Why is it needed? Can we get rid of it. That would be a step toward simplifying the RuntimeFramework class, which I'd like to get rid of anyway! Would you care to look into this? |
@madelson Downgrading |
@CharliePoole Yes, I wouldn't mind. I now ran into this issues twice. Can you create a new ticket outlining what you expect (copy what you said above?) and assign it to me. |
I tried this but it did not work for me :-/ |
@madelson This issue was reported against the console runner, so you may want to deal with your own problem separately, by bringing it to @OsirisTerje 's attention in the adapter repository. I just updated my post about engine version conflicts when using the adapter and the console runner to bring it up to the latest adapter release. There's a table that shows what engine version you are using for an version of the adapter. That may possibly help. |
@CharliePoole This is an error appearing in the adapter, but its roots are here in the engine, so I suggest we reopen this issue and solve it here. |
Fixed in 3.16 with the installation of a .NET 7.0 agent. |
I'm facing a similar error. Any probably date for 3.16 to be published to Nuget? |
@fedefrei Are you encountering this in version 3.15.2? The source indicates it's fixed there. |
@CharliePoole maybe I'm in the wrong neighborhood. |
@fedefrei The test adapter uses the NUnit engine, which is part of this project... in fact the biggest part. When you use the adapter, you get the particular engine version, against which your particular adapter version was built. For adapter 4.2.0, I believe that's version 3.13, which still has this problem. Obviously, no engine release will help you if you aren't using it and you can't make the adapter use a different version from the one that is built in. |
This issue has been resolved in version 3.16.0 The release is available on: |
We'd need a fix for NUnit3TestAdapter too... |
This is the console project. However, I happen to know that the adapter incorporated the fix in version 4.3.0. |
@CharliePoole i looked at #1175 WIth the way i read that code, when .net 8 is released in 12 months, this same problem will happen again and everyone will need to do the nuget upgrade dance? Does this code have to throw the exception? |
@BlythMeister If we get version 4.0 released before that, then it will not be an issue - see #1177 or Charlie's and Manfred's comments above in this issue for more information. |
@BlythMeister Unfortunately, it's not good enough to not throw an exception. The code actually has to return some value. The best solution is to do away with the method entirely. I tried to do that in 3.15 but was not able to do so... it's used in one case I'm unable to eliminate. The 4.0 code makes breaking changes and does away with the entire RuntimeFramework class. |
to allow tests to run in .NET Framework (nunit/nunit-console#1176)
to allow tests to run in .NET Framework (nunit/nunit-console#1176)
…tures Refer NUnit bug #1176 nunit/nunit-console#1176
We are facing this issue with .net 8 as well. As far as i can quickly tell is the same problem |
@BlythMeister @Patrickkk Please use 3.15.4 , it works on .net 8 and all forward going frameworks. We do have issue with the 3.16.X series, that breaks in different ways, and the 4.0 version have its own problems, it is not ready, and last but not least, we do lack resources (aka people) to work on this. But the 3.15.X series is being maintained. It is the same used with the adapter. Also, if there are specific issues in the 3.16.X series that you miss in the 3.15.X series, we can probably port them over. |
@OsirisTerje Thanks for the quick reply, will give it a go. |
Reproduce
dotnet new nunit
net48
Full csproj
The text was updated successfully, but these errors were encountered: