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

Fix for #1307 #1309

Merged
merged 3 commits into from
Jan 18, 2023
Merged

Fix for #1307 #1309

merged 3 commits into from
Jan 18, 2023

Conversation

OsirisTerje
Copy link
Member

Fix for #1307 : NUnit3TestAdapter integration: Exception when using NUnit.Engine 3.16.2

Removed the line that caused the nullref exception, as the resulting variable was not used in the method.

Copy link
Member

@CharliePoole CharliePoole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That change seems to do it, and you may want to merge and release in order to fix the problem with the adapter. However, see my inline comment and my general comment as well.

@@ -108,7 +108,8 @@ private static string GetDotNetInstallDirectory()

private static string FindBestVersionDir(string libraryDir, Version targetVersion)
{
string target = targetVersion.ToString();
if (targetVersion == null)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be clearer to put the null check in the calling code and never call this method with a null version. Since it's a private method and is only called in one place, I don't think a guard is really needed, but you could add one here in addition to the external check.

@CharliePoole
Copy link
Member

Here's another possibility - a bit more work maybe but could eliminate future problems.

We started having problems after I put code in the engine to load .NET Core dependencies,
eventually using Microsoft.Extensions.DependencyModel. I had to do that for the console
and GUI but the adapter never actually needed it.

Should we consider bypassing that code when running under the adapter? The engine could probably detect
the environment in which it is used, but it might be cleaner to just introduce a setting, which would eliminate
all or part of the Reload event handling I introduced.

@CharliePoole
Copy link
Member

BTW, I am trying to strike a balance here between following procedures as they are written and common sense.

As I'm no longer part of the Engine Team, I should only comment rather than approve a PR. Nevertheless, I did use the Approved selection to indicate that I think it's a good change. I also added some alternative suggestions.

On the other hand, I'll now leave it to someone else to actually merge any change.

@OsirisTerje OsirisTerje merged commit 67fbaeb into version3 Jan 18, 2023
@OsirisTerje OsirisTerje deleted the fixNullVersion branch January 18, 2023 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants