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

Inconsistencies between nunit3-console and running the project via Visual Studio #1208

Closed
OAguinagalde opened this issue Aug 12, 2022 · 18 comments

Comments

@OAguinagalde
Copy link

Running...

dotnet build
nunit3-console.exe .\ServiceTest.csproj

I get...

NUnit Console 3.15.2 (Release)
Copyright (c) 2022 Charlie Poole, Rob Prouse
Friday, August 12, 2022 3:50:57 PM

Runtime Environment
   OS Version: Microsoft Windows NT 6.2.9200.0
   Runtime: .NET Framework CLR v4.0.30319.42000

Test Files
    .\ServiceTest.csproj

Test Filters
    Test: SomeTests.MyTest


Errors, Failures and Warnings
1) Error : ServiceTest.LoginTest.NewGoogleUserLoginTest(Google,Google)
System.Exception : System.IO.FileNotFoundException: Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at MySql.Data.MySqlClient.MySqlConnection.AssertPermissions()
   at MySql.Data.MySqlClient.MySqlConnection.Open()

The same test run through Visual Studio (or Visual Studio Code) runs without issues.

I'm guessing this has to do with the version being used when run via VS and when running it via nunit3-console. I'm not too familiar with all the versioning stuff with C# and .net.

Checking the dependencies of MySql.Data project in VS shows that it depends on System.Security.Permissions, Version=4.7.0 but for some reason the error running nunit3-console shows that it is looking for System.Security.Permissions, Version=4.0.3.0.
image

I see that nunit3-console is running Runtime: .NET Framework CLR v4.0.3 while my project is targetting net5.0. Not sure if this is the problem, and if it is, I have tried using the --framework flag without success, whatever I write, it doesn't recognize it.

This is the csproj file:

> cat .\ServiceTest.csproj
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <Nullable>enable</Nullable>

    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
    <PackageReference Include="NUnit" Version="3.13.2" />
    <PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="SomeProject" />
    <ProjectReference Include="SomeProject" />
  </ItemGroup>

</Project>

some other notes on my system:

> dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

> dotnet --list-sdks
5.0.408 [C:\Program Files\dotnet\sdk]
6.0.302 [C:\Program Files\dotnet\sdk]

> where.exe dotnet
C:\Program Files\dotnet\dotnet.exe

I installed nunit3-console using dotnet add package NUnit.Console --version 3.15.2. The project references:
<PackageReference Include="NUnit" Version="3.13.2" /> and <PackageReference Include="NUnit3TestAdapter" Version="4.0.0" /> where added some time ago unlike the console which I got it today.

Using --inprocess gives this exception:

NUnit.Engine.NUnitEngineException : The NUnit 3 driver encountered an error while executing reflected code.
  ----> System.InvalidCastException : Unable to cast transparent proxy to type 'System.Web.UI.ICallbackEventHandler'.

--NUnitEngineException
The NUnit 3 driver encountered an error while executing reflected code.
   at NUnit.Engine.Drivers.NUnit3FrameworkDriver.CreateObject(String typeName, Object[] args)
   at NUnit.Engine.Drivers.NUnit3FrameworkDriver.Load(String testAssemblyPath, IDictionary`2 settings)
   at NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
   at NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
   at NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
   at NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
   at NUnit.Engine.Runners.MasterTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
   at NUnit.Engine.Runners.MasterTestRunner.Run(ITestEventListener listener, TestFilter filter)
   at NUnit.ConsoleRunner.ConsoleRunner.RunTests(TestPackage package, TestFilter filter)
--
InvalidCastException
Unable to cast transparent proxy to type 'System.Web.UI.ICallbackEventHandler'.
   at NUnit.Framework.Api.FrameworkController.LoadTestsAction..ctor(FrameworkController controller, Object handler)

My objective is to use nunit3-console.

@CharliePoole
Copy link
Collaborator

Some miscellaneous observations.

Regarding running under VS versus under NUnit3Console... Of course it's a problem if the console runner can't run your tests, but it's not surprising if one works and the other doesn't... they are different pieces of software after all, written and maintained by different people. :-) Of course both the console runner and the NUnit adapter use the NUnit engine to run tests, but it's likely that they are using two different versions of the engine and calling it in different ways.

When you use --inprocess, you are telling NUnit to try to load a .NET 5.0 test into a process running .NET Framework. That can't possibly work. Unfortunately, the actual error isn't reported very well. Anyway, don't try to run in the process unless you have a test assembly that targets the .NET Framework.

I suggest simplifying things so we can try to debug this... Remove the reference to the NUnit3TestAdapter, which is not used by the console runner but may actually cause an engine version conflict. Use the test assembly (dll) as your argument rather than the csproj file so we are not using the project loader extension. Use the --trace:Debug argument and examine the log files to see if one of them tells you what is actually happen in the reflected code.

Let me know what you learn and we'll take it from there.

@OAguinagalde
Copy link
Author

Hey, thanks for the explanations :)

I did as you suggested and tried pointing at the dll and removed the reference NUnit3TestAdapter in the project file before rebuilding the project. The result is the same, here is the output of the log file:

InternalTrace: Initializing at level Debug
17:32:15.701 Debug [ 1] ServiceManager: Added SettingsService
17:32:15.701 Debug [ 1] ServiceManager: Added RecentFilesService
17:32:15.701 Debug [ 1] ServiceManager: Added TestFilterService
17:32:15.702 Debug [ 1] ServiceManager: Added ExtensionService
17:32:15.702 Debug [ 1] ServiceManager: Added ProjectService
17:32:15.702 Debug [ 1] ServiceManager: Added RuntimeFrameworkService
17:32:15.708 Debug [ 1] ServiceManager: Added TestAgency
17:32:15.708 Debug [ 1] ServiceManager: Added DriverService
17:32:15.708 Debug [ 1] ServiceManager: Added ResultService
17:32:15.708 Debug [ 1] ServiceManager: Added DefaultTestRunnerFactory
17:32:15.709 Info  [ 1] ServiceManager: Initializing SettingsService
17:32:15.710 Info  [ 1] ServiceManager: Initializing RecentFilesService
17:32:15.710 Debug [ 1] ServiceManager: Request for service ISettings satisfied by SettingsService
17:32:15.711 Info  [ 1] ServiceManager: Initializing TestFilterService
17:32:15.711 Info  [ 1] ServiceManager: Initializing ExtensionService
17:32:15.712 Info  [ 1] ExtensionService: Scanning nunit.engine.core assembly for extension points
17:32:15.712 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/NUnitV2Driver, Type=NUnit.Engine.Extensibility.IFrameworkDriver
17:32:15.715 Info  [ 1] ExtensionService: Scanning nunit.engine.api assembly for extension points
17:32:15.715 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/TypeExtensions/IService, Type=NUnit.Engine.IService
17:32:15.715 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/TypeExtensions/ITestEventListener, Type=NUnit.Engine.ITestEventListener
17:32:15.715 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/TypeExtensions/IDriverFactory, Type=NUnit.Engine.Extensibility.IDriverFactory
17:32:15.715 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/TypeExtensions/IProjectLoader, Type=NUnit.Engine.Extensibility.IProjectLoader
17:32:15.715 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/TypeExtensions/IResultWriter, Type=NUnit.Engine.Extensibility.IResultWriter
17:32:15.719 Info  [ 1] ExtensionService: Processing file C:\Users\user\.nuget\packages\nunit.consolerunner\3.15.2\tools\nunit.console.nuget.addins
17:32:15.723 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitprojectloader\3.6.0\tools' for extensions.
17:32:15.781 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitv2driver\3.8.0\tools' for extensions.
17:32:15.781 Info  [ 1] ExtensionService: Processing file C:\Users\user\.nuget\packages\nunit.extension.nunitv2driver\3.8.0\tools\nunit.v2.driver.addins
17:32:15.782 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitv2resultwriter\3.6.0\tools' for extensions.
17:32:15.783 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.extension.teamcityeventlistener\1.0.7\tools' for extensions.
17:32:15.783 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.extension.vsprojectloader\3.8.0\tools' for extensions.
17:32:15.785 Warning [ 1] ExtensionService: Skipping directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitprojectloader\3.6.0\tools' because it was already visited.
17:32:15.785 Warning [ 1] ExtensionService: Skipping directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitv2driver\3.8.0\tools' because it was already visited.
17:32:15.785 Warning [ 1] ExtensionService: Skipping directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitv2resultwriter\3.6.0\tools' because it was already visited.
17:32:15.785 Warning [ 1] ExtensionService: Skipping directory 'C:\Users\user\.nuget\packages\nunit.extension.teamcityeventlistener\1.0.7\tools' because it was already visited.
17:32:15.785 Warning [ 1] ExtensionService: Skipping directory 'C:\Users\user\.nuget\packages\nunit.extension.vsprojectloader\3.8.0\tools' because it was already visited.
17:32:15.787 Info  [ 1] ExtensionService: Scanning C:\Users\user\.nuget\packages\nunit.extension.nunitprojectloader\3.6.0\tools\nunit-project-loader.dll for Extensions
17:32:15.795 Info  [ 1] ExtensionService:   Found ExtensionAttribute on Type NUnitProjectLoader
17:32:15.797 Info  [ 1] ExtensionService:         ExtensionProperty FileExtension = .nunit
17:32:15.800 Info  [ 1] ExtensionService: Scanning C:\Users\user\.nuget\packages\nunit.extension.nunitv2driver\3.8.0\tools\nunit.v2.driver.dll for Extensions
17:32:15.801 Info  [ 1] ExtensionService:   Found ExtensionAttribute on Type NUnit2FrameworkDriver
17:32:15.801 Info  [ 1] ExtensionService: Scanning C:\Users\user\.nuget\packages\nunit.extension.nunitv2resultwriter\3.6.0\tools\nunit-v2-result-writer.dll for Extensions
17:32:15.801 Info  [ 1] ExtensionService:   Found ExtensionAttribute on Type NUnit2XmlResultWriter
17:32:15.801 Info  [ 1] ExtensionService:         ExtensionProperty Format = nunit2
17:32:15.801 Info  [ 1] ExtensionService: Scanning C:\Users\user\.nuget\packages\nunit.extension.teamcityeventlistener\1.0.7\tools\teamcity-event-listener.dll for Extensions
17:32:15.804 Info  [ 1] ExtensionService:   Found ExtensionAttribute on Type TeamCityEventListener
17:32:15.804 Info  [ 1] ExtensionService: Scanning C:\Users\user\.nuget\packages\nunit.extension.vsprojectloader\3.8.0\tools\vs-project-loader.dll for Extensions
17:32:15.805 Info  [ 1] ExtensionService:   Found ExtensionAttribute on Type VisualStudioProjectLoader
17:32:15.805 Info  [ 1] ExtensionService:         ExtensionProperty FileExtension = .sln
17:32:15.805 Info  [ 1] ExtensionService:         ExtensionProperty FileExtension = .csproj
17:32:15.805 Info  [ 1] ExtensionService:         ExtensionProperty FileExtension = .vbproj
17:32:15.805 Info  [ 1] ExtensionService:         ExtensionProperty FileExtension = .vjsproj
17:32:15.805 Info  [ 1] ExtensionService:         ExtensionProperty FileExtension = .vcproj
17:32:15.805 Info  [ 1] ExtensionService:         ExtensionProperty FileExtension = .fsproj
17:32:15.805 Info  [ 1] ServiceManager: Initializing ProjectService
17:32:15.806 Debug [ 1] ServiceManager: Request for service ExtensionService satisfied by ExtensionService
17:32:15.808 Info  [ 1] ServiceManager: Initializing RuntimeFrameworkService
17:32:15.808 Info  [ 1] ServiceManager: Initializing TestAgency
17:32:15.808 Debug [ 1] ServiceManager: Request for service IRuntimeFrameworkService satisfied by RuntimeFrameworkService
17:32:15.813 Info  [ 1] ServiceManager: Initializing DriverService
17:32:15.814 Debug [ 1] ServiceManager: Request for service ExtensionService satisfied by ExtensionService
17:32:15.815 Info  [ 1] ServiceManager: Initializing ResultService
17:32:15.815 Debug [ 1] ServiceManager: Request for service ExtensionService satisfied by ExtensionService
17:32:15.815 Info  [ 1] ServiceManager: Initializing DefaultTestRunnerFactory
17:32:15.815 Debug [ 1] ServiceManager: Request for service IProjectService satisfied by ProjectService
17:32:15.815 Debug [ 1] ServiceManager: Request for service IResultService satisfied by ResultService
17:32:15.815 Debug [ 1] ServiceManager: Request for service ITestFilterService satisfied by TestFilterService
17:32:15.815 Debug [ 1] ServiceManager: Request for service IExtensionService satisfied by ExtensionService
17:32:15.832 Debug [ 1] ServiceManager: Request for service IProjectService satisfied by ProjectService
17:32:15.832 Debug [ 1] ServiceManager: Request for service ITestRunnerFactory satisfied by DefaultTestRunnerFactory
17:32:15.833 Debug [ 1] ServiceManager: Request for service IRuntimeFrameworkService satisfied by RuntimeFrameworkService
17:32:15.833 Debug [ 1] ServiceManager: Request for service ExtensionService satisfied by ExtensionService
17:32:15.845 Debug [ 1] RuntimeFrameworkService: Assembly C:\Users\user\git_projects\NotRealNameServer\ServiceTest\bin\Debug\net5.0\ServiceTest.dll uses version 4.0.30319
17:32:15.845 Debug [ 1] RuntimeFrameworkService: Assembly C:\Users\user\git_projects\NotRealNameServer\ServiceTest\bin\Debug\net5.0\ServiceTest.dll targets .NETCoreApp,Version=v5.0
17:32:15.847 Debug [ 1] RuntimeFrameworkService: Current framework is net-4.5
17:32:15.847 Debug [ 1] RuntimeFrameworkService: No specific framework requested for ServiceTest.dll
17:32:15.849 Debug [ 1] RuntimeFrameworkService: Test will use netcore-5.0 for ServiceTest.dll
17:32:15.849 Debug [ 1] RuntimeFrameworkService: Current framework is net-4.5
17:32:15.849 Debug [ 1] RuntimeFrameworkService: No specific framework requested for 
17:32:15.849 Debug [ 1] RuntimeFrameworkService: Test will use netcore-5.0 for 
17:32:15.850 Debug [ 1] ServiceManager: Request for service ITestRunnerFactory satisfied by DefaultTestRunnerFactory
17:32:15.850 Debug [ 1] ServiceManager: Request for service TestAgency satisfied by TestAgency
17:32:15.850 Info  [ 1] ProcessRunner: Running 
17:32:15.855 Debug [ 1] AgentProcess: TargetRuntime = netcore-5.0
17:32:15.856 Debug [ 1] AgentProcess: GetTestAgentExePath(netcore-5.0, False)
17:32:15.856 Debug [ 1] AgentProcess: Checking for agents at C:\Users\user\.nuget\packages\nunit.consolerunner\3.15.2\tools\agents
17:32:15.856 Debug [ 1] AgentProcess: Using nunit-agent at C:\Users\user\.nuget\packages\nunit.consolerunner\3.15.2\tools\agents\net5.0\nunit-agent.dll
17:32:15.912 Debug [ 1] TestAgency: Launched Agent process 128164 - see nunit-agent_128164.log
17:32:15.912 Debug [ 1] TestAgency: Command line: "dotnet" C:\Users\user\.nuget\packages\nunit.consolerunner\3.15.2\tools\agents\net5.0\nunit-agent.dll a86e0ba6-2e9b-4824-9393-3ed0eb8d7c23 127.0.0.1:51134 --pid=2060 --trace=Debug --work=C:\Users\user\git_projects\NotRealNameServer\ServiceTest
17:32:15.914 Debug [ 1] TestAgency: Waiting for agent {a86e0ba6-2e9b-4824-9393-3ed0eb8d7c23} to register
17:32:16.126 Debug [ 1] TestAgency: Returning new agent {a86e0ba6-2e9b-4824-9393-3ed0eb8d7c23}
17:32:16.607 Info  [ 1] ProcessRunner: Done running 
17:32:16.612 Info  [ 1] ProcessRunner: Unloading 
17:32:16.612 Debug [ 1] ProcessRunner: Stopping remote agent
17:32:16.635 Info  [ 1] ServiceManager: Stopping DefaultTestRunnerFactory
17:32:16.635 Info  [ 1] ServiceManager: Stopping ResultService
17:32:16.635 Info  [ 1] ServiceManager: Stopping DriverService
17:32:16.635 Info  [ 1] ServiceManager: Stopping TestAgency
17:32:16.636 Info  [ 1] ServiceManager: Stopping RuntimeFrameworkService
17:32:16.636 Info  [ 1] ServiceManager: Stopping ProjectService
17:32:16.636 Info  [ 1] ServiceManager: Stopping ExtensionService
17:32:16.636 Info  [ 1] ServiceManager: Stopping TestFilterService
17:32:16.636 Info  [ 1] ServiceManager: Stopping RecentFilesService
17:32:16.637 Info  [ 1] ServiceManager: Stopping SettingsService

There is a lot of mentions of frameworks and runtimes and SDKs and I'm a bit confused by all these things when it comes to .net and C#, so I keep thinking it might be related?

@CharliePoole
Copy link
Collaborator

The log you posted is the log for the main process running nunit3-console.exe and has no errors. As shown at 17:32:15.856, the agent process log is `nunit-agent_128164.log. If any tests actually ran, there will be a third log, produced by the nunit framework, as well.

You need to examine all the logs to find any Error lines, which give a reason for the crash.

@OAguinagalde
Copy link
Author

Oh, my I see. Here is the log nunit-agent_128164.log:

InternalTrace: Initializing at level Debug
17:32:15.960 Info  [ 1] NUnitTestAgent: Agent process 128164 starting
17:32:15.966 Debug [ 1] ServiceManager: Added ExtensionService
17:32:15.966 Debug [ 1] ServiceManager: Added DriverService
17:32:15.966 Info  [ 1] NUnitTestAgent: Initializing Services
17:32:15.966 Info  [ 1] ServiceManager: Initializing ExtensionService
17:32:15.968 Info  [ 1] ExtensionService: Scanning nunit.engine.core assembly for extension points
17:32:15.970 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/NUnitV2Driver, Type=NUnit.Engine.Extensibility.IFrameworkDriver
17:32:15.972 Info  [ 1] ExtensionService: Scanning nunit.engine.api assembly for extension points
17:32:15.972 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/TypeExtensions/IService, Type=NUnit.Engine.IService
17:32:15.972 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/TypeExtensions/ITestEventListener, Type=NUnit.Engine.ITestEventListener
17:32:15.972 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/TypeExtensions/IDriverFactory, Type=NUnit.Engine.Extensibility.IDriverFactory
17:32:15.972 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/TypeExtensions/IProjectLoader, Type=NUnit.Engine.Extensibility.IProjectLoader
17:32:15.972 Info  [ 1] ExtensionService:   Found Path=/NUnit/Engine/TypeExtensions/IResultWriter, Type=NUnit.Engine.Extensibility.IResultWriter
17:32:15.987 Info  [ 1] ExtensionService: Processing file C:\Users\user\.nuget\packages\nunit.consolerunner\3.15.2\tools\agents\net5.0\nunit.agent.addins
17:32:15.990 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.consolerunner\3.15.2\tools' for extensions.
17:32:15.990 Info  [ 1] ExtensionService: Processing file C:\Users\user\.nuget\packages\nunit.consolerunner\3.15.2\tools\nunit.console.nuget.addins
17:32:15.992 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitprojectloader\3.6.0\tools' for extensions.
17:32:16.026 Info  [ 1] ExtensionService: .NET Core runners require .NET Core or .NET Standard extension for C:\Users\user\.nuget\packages\nunit.extension.nunitprojectloader\3.6.0\tools\nunit-project-loader.dll
17:32:16.026 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitv2driver\3.8.0\tools' for extensions.
17:32:16.026 Info  [ 1] ExtensionService: Processing file C:\Users\user\.nuget\packages\nunit.extension.nunitv2driver\3.8.0\tools\nunit.v2.driver.addins
17:32:16.027 Info  [ 1] ExtensionService: .NET Core runners require .NET Core or .NET Standard extension for C:\Users\user\.nuget\packages\nunit.extension.nunitv2driver\3.8.0\tools\nunit.v2.driver.dll
17:32:16.027 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitv2resultwriter\3.6.0\tools' for extensions.
17:32:16.027 Info  [ 1] ExtensionService: .NET Core runners require .NET Core or .NET Standard extension for C:\Users\user\.nuget\packages\nunit.extension.nunitv2resultwriter\3.6.0\tools\nunit-v2-result-writer.dll
17:32:16.027 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.extension.teamcityeventlistener\1.0.7\tools' for extensions.
17:32:16.028 Info  [ 1] ExtensionService: .NET Core runners require .NET Core or .NET Standard extension for C:\Users\user\.nuget\packages\nunit.extension.teamcityeventlistener\1.0.7\tools\teamcity-event-listener.dll
17:32:16.028 Info  [ 1] ExtensionService: Scanning directory 'C:\Users\user\.nuget\packages\nunit.extension.vsprojectloader\3.8.0\tools' for extensions.
17:32:16.028 Info  [ 1] ExtensionService: .NET Core runners require .NET Core or .NET Standard extension for C:\Users\user\.nuget\packages\nunit.extension.vsprojectloader\3.8.0\tools\vs-project-loader.dll
17:32:16.029 Warning [ 1] ExtensionService: Skipping directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitprojectloader\3.6.0\tools' because it was already visited.
17:32:16.029 Warning [ 1] ExtensionService: Skipping directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitv2driver\3.8.0\tools' because it was already visited.
17:32:16.029 Warning [ 1] ExtensionService: Skipping directory 'C:\Users\user\.nuget\packages\nunit.extension.nunitv2resultwriter\3.6.0\tools' because it was already visited.
17:32:16.029 Warning [ 1] ExtensionService: Skipping directory 'C:\Users\user\.nuget\packages\nunit.extension.teamcityeventlistener\1.0.7\tools' because it was already visited.
17:32:16.029 Warning [ 1] ExtensionService: Skipping directory 'C:\Users\user\.nuget\packages\nunit.extension.vsprojectloader\3.8.0\tools' because it was already visited.
17:32:16.029 Info  [ 1] ServiceManager: Initializing DriverService
17:32:16.030 Debug [ 1] ServiceManager: Request for service ExtensionService satisfied by ExtensionService
17:32:16.031 Info  [ 1] NUnitTestAgent: Starting RemoteTestAgent
17:32:16.033 Info  [ 1] TestAgentTcpTransport: Connecting to TestAgency at 127.0.0.1:51134
17:32:16.039 Debug [ 1] NUnitTestAgent: Waiting for stopSignal
17:32:16.134 Error [ 4] ServiceManager: Requested service NUnit.Engine.ITestRunnerFactory was not found
17:32:16.137 Debug [ 4] ServiceManager: Request for service IDriverService satisfied by DriverService
17:32:16.139 Debug [ 4] DriverService: Trying NUnit3DriverFactory
17:32:16.139 Info  [ 4] NUnit3DriverFactory: Using NUnitNetCore31Driver
17:32:16.140 Debug [ 4] NUnitNetCore31Driver: Loading C:\Users\user\git_projects\Server\ServiceTest\bin\Debug\net5.0\ServiceTest.dll
17:32:16.147 Debug [ 4] NUnitNetCore31Driver: Loaded C:\Users\user\git_projects\Server\ServiceTest\bin\Debug\net5.0\ServiceTest.dll
17:32:16.148 Debug [ 4] NUnitNetCore31Driver: Loaded nunit.framework
17:32:16.155 Debug [ 4] NUnitNetCore31Driver: Created FrameworkControler FrameworkController
17:32:16.155 Info  [ 4] NUnitNetCore31Driver: Loading ServiceTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - see separate log file
17:32:16.155 Debug [ 4] NUnitNetCore31Driver: Executing NUnit.Framework.Api.FrameworkController.LoadTests
17:32:16.189 Info  [ 4] NUnitNetCore31Driver: Running ServiceTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - see separate log file
17:32:16.613 Debug [ 1] NUnitTestAgent: Stop signal received
17:32:16.613 Info  [ 1] NUnitTestAgent: Agent process 128164 exiting cleanly

there is one error in the log:

17:32:16.134 Error [ 4] ServiceManager: Requested service NUnit.Engine.ITestRunnerFactory was not found

Not sure what that means though. And just to make sure there is no misunderstanding. The console nunit3-console is not crashing, its my test code that is crashing. My code crashes because its looking for a package System.Security.Permissions, Version=4.0.3.0 (the library MySQL.Data has System.Security.Permissions, Version=4.0.7.0 as a dependency) and cant find it.

@CharliePoole
Copy link
Collaborator

CharliePoole commented Aug 16, 2022 via email

@OAguinagalde
Copy link
Author

Managed to find the log file from the same execution when I created the issue!
File name was .\InternalTrace.128164.ServiceTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.log, quite the name.
I have a feeling there is nothing much of use in there:

InternalTrace: Initializing at level Debug
17:32:16.156 Debug [ 4] DefaultTestAssemblyBuilder: Loading ServiceTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null in AppDomain nunit-agent
17:32:16.158 Debug [ 4] DefaultTestAssemblyBuilder: Examining assembly for test fixtures
17:32:16.162 Debug [ 4] DefaultTestAssemblyBuilder: Found 137 classes to examine
17:32:16.183 Debug [ 4] DefaultTestAssemblyBuilder: Found 25 fixtures with 182 test cases
17:32:16.193 Info  [ 4] DefaultTestAssemblyRunner: Running tests
17:32:16.194 Info  [ 4] Dispatcher: Initializing with 16 workers
17:32:16.195 Debug [ 4] WorkShift: Parallel shift adding queue ParallelQueue
17:32:16.195 Debug [ 4] WorkShift: Parallel shift adding queue ParallelSTAQueue
17:32:16.195 Debug [ 4] WorkShift: NonParallel shift adding queue NonParallelQueue
17:32:16.195 Debug [ 4] WorkShift: NonParallelSTA shift adding queue NonParallelSTAQueue
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#1
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#2
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#3
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#4
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#5
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#6
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#7
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#8
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#9
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#10
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#11
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#12
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#13
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#14
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#15
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelWorker#16
17:32:16.195 Debug [ 4] WorkShift: Parallel shift assigned worker ParallelSTAWorker
17:32:16.195 Debug [ 4] WorkShift: NonParallel shift assigned worker NonParallelWorker
17:32:16.195 Debug [ 4] WorkShift: NonParallelSTA shift assigned worker NonParallelSTAWorker
17:32:16.198 Debug [ 4] Dispatcher: Using NonParallel strategy for ServiceTest.dll
17:32:16.198 Debug [ 6] EventPump: Starting EventPump
17:32:16.199 Info  [ 4] WorkShift: NonParallel shift starting
17:32:16.199 Info  [ 4] TestWorker: NonParallelWorker starting on thread [7]
17:32:16.200 Info  [ 4] WorkItemQueue: NonParallelQueue.0 starting
17:32:16.200 Info  [ 7] TestWorker: NonParallelWorker executing ServiceTest.dll
17:32:16.203 Debug [ 7] Dispatcher: Using Direct strategy for ServiceTest
17:32:16.203 Debug [ 7] Dispatcher: Using NonParallel strategy for LoginTest
17:32:16.203 Info  [ 7] TestWorker: NonParallelWorker executing LoginTest
17:32:16.203 Info  [ 7] Dispatcher: Saving Queue State for LoginTest
17:32:16.204 Debug [ 7] WorkItemQueue: NonParallelQueue.0 pausing
17:32:16.204 Info  [ 7] WorkItemQueue: NonParallelQueue.1 starting
17:32:16.547 Debug [ 7] Dispatcher: Using Direct strategy for NewGoogleUserLoginTest
17:32:16.547 Debug [ 7] Dispatcher: Using Direct strategy for NewGoogleUserLoginTest(Google,Google)
17:32:16.600 Debug [ 7] Dispatcher: Using Direct strategy for NewGoogleUserLoginTest OneTimeTearDown
17:32:16.601 Debug [ 7] Dispatcher: Using NonParallel strategy for LoginTest OneTimeTearDown
17:32:16.601 Info  [ 7] TestWorker: NonParallelWorker executing LoginTest OneTimeTearDown
17:32:16.602 Debug [ 7] Dispatcher: Using Direct strategy for ServiceTest OneTimeTearDown
17:32:16.602 Debug [ 7] Dispatcher: Using Direct strategy for ServiceTest.dll OneTimeTearDown
17:32:16.602 Debug [ 6] EventPump: EventPump Terminating
17:32:16.603 Info  [ 7] WorkShift: NonParallel shift ending
17:32:16.603 Debug [ 7] WorkItemQueue: NonParallelQueue.1 pausing
17:32:16.603 Info  [ 7] Dispatcher: Restoring Queue State
17:32:16.603 Info  [ 7] WorkItemQueue: ParallelQueue.0 stopping - 0 WorkItems processed
17:32:16.603 Info  [ 7] WorkItemQueue: ParallelSTAQueue.0 stopping - 0 WorkItems processed
17:32:16.603 Info  [ 7] WorkItemQueue: NonParallelQueue.0 stopping - 3 WorkItems processed
17:32:16.603 Info  [ 7] WorkItemQueue: NonParallelSTAQueue.0 stopping - 0 WorkItems processed
17:32:16.603 Info  [ 7] TestWorker: NonParallelWorker stopping - 3 WorkItems processed.

And yes, I remember step debugging my own code until it reaches a point in which it goes inside a function from the MySQL.Data library, and somewhere inside it suddenly there is a reference to System.Security.Permissions and at that point is when the exception is thrown. So, I guess that yes, somehow the System.Security.Permissions is being loaded dynamically.

I've looked into it and I have found the following regarding assembly load (binding?) in C#...

https://michaelscodingspot.com/assemblies-load-in-dotnet/#:~:text=It%20will%20usually%20be%20Bin,called%20binding%20to%20the%20assembly.
When you reference a project from another project, at build time, the referenced project’s DLL or EXE are copied to the Bin folder of the startup project. It will usually be Bin\Debug or Bin\Release. At runtime, when you use a type from a referenced project for the first time, the CLR looks in the application directory for the DLL file with the same name and version it expects. It then loads that assembly into the process. This is also called binding to the assembly.

I've checked and there is no System.Security.Permissions.dll in my the binaries folder... which might explain the problem, except that Visual Studio has no such problem .

Also I found out that there is certain json files that get generated on build, which specify dependencies and assemblies and other stuff. I looked into those and see that for some reason, in the file obj/project.assets.json the keytargets > net5.0 > MySql.Data/8.0.27 > dependencies > System.Security.Permissions is 4.0.7 while in every other place it has the value 5.0.0. I don't know enough to debug or understand whats going on here or what all these mean though.

@OAguinagalde
Copy link
Author

I have noticed that System.AppDomain.CurrentDomain.BaseDirectory changes its value when running via Visual Studio (points to the folder where the built DLL is) and when running the test via the nunit3 console (points to where the console is C:\\Users\\user\\.nuget\\packages\\nunit.consolerunner\\3.15.2\\tools\\agents\\net5.0\\).

I have also read that that path is the used to prove for assembly probing. I wonder if that could be related... And if so, is there a way to test that?

@OAguinagalde
Copy link
Author

I think I have found the issue, partially.

I have found the way to check what are all the *.deps.json files being used by the runtime:

var allTheUsedDepsFiles = System.AppContext.GetData("APP_CONTEXT_DEPS_FILES");

After checking that both running via VS and the nunit console this are the contents.

    Visual Studio
C:\\Users\\user\\git_projects\\MYSOLUTION\\ServiceTest\\bin\\Debug\\net5.0\\ServiceTest.deps.json
C:\\Program Files\\dotnet\\shared\\Microsoft.AspNetCore.App\\5.0.17\\Microsoft.AspNetCore.App.deps.json
C:\\Program Files\\dotnet\\shared\\Microsoft.NETCore.App\\5.0.17\\Microsoft.NETCore.App.deps.json

    nunit3-console:
C:\\Users\\user\\.nuget\\packages\\nunit.consolerunner\\3.15.2\\tools\\agents\\net5.0\\nunit-agent.deps.json;
C:\\Program Files\\dotnet\\shared\\Microsoft.NETCore.App\\5.0.17\\Microsoft.NETCore.App.deps.json

And sure enough, I found the exact version of the assembly that visual studio was loading in the Microsoft.AspNetCore.App.deps.json file:

          "System.Security.Permissions.dll": {
            "assemblyVersion": "5.0.0.0",
            "fileVersion": "5.0.20.51904"
          },

Here is the modules view when debugging via Visual Studio:
modules

It doesnt show the version, but it matches that of the deps file.

What I dont know now, is whether nunit not using that deps file is something expected and something I have to configure or if it is a bug. Also, I'm not sure why its not using my own projects deps file.

Also... Why is it using the version 5 of the assembly when nuget has downloaded the correct version of the assembly specified as a dependency by the library? 🤔

@cw397
Copy link

cw397 commented Sep 22, 2022

We have a similar issue.

#1202, #1203 and #1208 all seem to be caused by projects using additional .NET libraries, i.e. Windows Forms, WPF or ASP.NET. Since NUnit Console doesn't use those libraries they don't get added to its runtimeconfig.json, which means that when the agent tries to run tests that use parts of those libraries it can't find them.

Our issue is with an unmanaged/native library. We are using a NuGet package (Esri.ArcGISRuntime) that has some unmanaged dependencies. As seems to be the convention, these get copied to a runtimes/{rid}/native folder within our test project bin/Debug directory, e.g. runtimes/win-x64/native. As with all the other issues, tests that use this library run fine in Visual Studio but fail with the error "Could not load ArcGIS Runtime (RuntimeCoreNet100_15.dll) or one of its dependencies" when run with NUnit Console.

I can workaround the issue in a couple of ways:

  1. Copy the relevant files out of the runtimes/{rid}/native folder and put them directly in the bin/Debug directory.
  2. Copy the entire runtimes folder into the .nuget\packages\nunit.consolerunner\3.15.2\tools\agents\net6.0 folder and also copy the relevant items from our test project's .deps.json file into the nunit-agent.deps.json file.

I have found some explanation about how native assemblies are probed for (https://learn.microsoft.com/en-us/dotnet/core/dependency-loading/default-probing), and potential ways of configuring it (https://github.com/dotnet/cli/blob/master/Documentation/specs/runtime-configuration-file.md), however I haven't been able to figure out any better workarounds than the two listed above.

@CharliePoole
Copy link
Collaborator

@cw397 Thanks! That's helpful information.

@CharliePoole
Copy link
Collaborator

A lot of different things have been discussed in this issue. Many have been solved and I would like to close it and create more narrow issues for what remains. There appear to be two remaining unclosed problems:

1. The problem with System.Security.Permissions not being found.

I believe that the fix to #1203 took care of this. @OAguinagalde can you verify using the MyGet release of the console runner? Version 3.16.0-dev00043 or a higher 3.16 version should have it.

2. The problem loading unmanaged libraries reported by @cw397

I haven't changed any code, which would effect this, so I'll make it a specific issue.


Have I missed anything in the discussion?

@OAguinagalde
Copy link
Author

OAguinagalde commented Oct 24, 2022

EDIT: Nevermind this, read the next comment!

Hello, I cloned (3dd9e50 - Merge pull request #1248 from nunit/issue-1246) and built the project directly PS C:\git_projects\nunit-console\src\NUnitConsole\nunit3-console> dotnet build, and used it for testing, and got this new error instead.
Although I wonder if this might be an unrelated issue cause by "having" 2 installations of nunit (the same one I used last time, which was installed by nuget, and this one built with dotnet build), not sure if that can cause problems? And if so, how do I remove the old one so that the new one is used?

I feel like I had this same issue when I first tested nunit-console and had a bunch of problems installing it, but dont remember how I fixed it back then...

PS C:\git_projects\nunit-console\src\NUnitConsole\nunit3-console> dotnet run --framework net462 C:\git_projects\SomeProject\ServiceTest\bin\Debug\net5.0\ServiceTest.dll
NUnit Console 3.99.0.0-VSIDE (Debug)
Copyright (c) 2022 Charlie Poole, Rob Prouse
Monday, October 24, 2022 12:59:42 PM

Runtime Environment
   OS Version: Microsoft Windows NT 6.2.9200.0
   Runtime: .NET Framework CLR v4.0.30319.42000

Test Files
    C:\git_projects\SomeProject\ServiceTest\bin\Debug\net5.0\ServiceTest.dll


Unhandled Exception: NUnit.Engine.NUnitEngineException: Remote test agent exited with non-zero exit code 1
   at NUnit.Engine.Services.TestAgency.OnAgentExit(Process process, Guid agentId) in C:\git_projects\nunit-console\src\NUnitEngine\nunit.engine\Services\TestAgency.cs:line 158
   at NUnit.Engine.Services.TestAgency.<>c__DisplayClass13_0.<GetAgent>b__0(Object sender, EventArgs e) in C:\git_projects\nunit-console\src\NUnitEngine\nunit.engine\Services\TestAgency.cs:line 73
   at System.Diagnostics.Process.OnExited()
   at System.Diagnostics.Process.RaiseOnExited()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(Object state, Boolean timedOut)

Errors, Failures and Warnings

1) Error :
NUnit.Engine.NUnitEngineException : Unable to acquire remote process agent
--NUnitEngineException
Unable to acquire remote process agent
   at NUnit.Engine.Runners.ProcessRunner.CreateAgentAndRunnerIfNeeded() in C:\git_projects\nunit-console\src\NUnitEngine\nunit.engine\Runners\ProcessRunner.cs:line 254
   at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter) in C:\git_projects\nunit-console\src\NUnitEngine\nunit.engine\Runners\ProcessRunner.cs:line 136

Test Run Summary
  Overall result: Failed
  Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
  Start time: 2022-10-24 03:59:42Z
    End time: 2022-10-24 03:59:43Z
    Duration: 0.459 seconds

Results (nunit3) saved as TestResult.xml

@OAguinagalde
Copy link
Author

OAguinagalde commented Oct 24, 2022

Edit: Ok, nevermid this as well, took another look, and once again I assumed things I shouldn't have assumed. This time I tried the version that you exactly said, the latest 3.16, and it works as you said, sorry!! And thanks so much for the support. I'll close this!

Original commnet:
Mmmmm sorry, I assumed that the git project and the MyGet would be the same as I didn't know what that was, but then I just found it! I downloaded the last version from MyGet and ran the test again. The original problem seems to still be there:

PS C:\Users\user\git_projects\SomeProject\ServiceTest> & "C:\Users\user\Downloads\NUnit.ConsoleRunner.4.0.0-dev00116\nunit-console.exe" C:\users\user\git_projects\SomeProject\ServiceTest\bin\Debug\net5.0\ServiceTest.dll --test=ServiceTest.LoginTest.MyTest
NUnit Console 4.0.0-dev00116 (Release)
Copyright (c) 2022 Charlie Poole, Rob Prouse
Monday, October 24, 2022 3:17:30 PM

Runtime Environment
    OS Version: Microsoft Windows NT 10.0.19043.0
    Runtime: .NET Framework CLR v4.0.30319.42000

Test Files
    C:\users\user\git_projects\SomeProject\ServiceTest\bin\Debug\net5.0\ServiceTest.dll

Test Filters
    Test: ServiceTest.LoginTest.MyTest


Errors, Failures and Warnings

1) Error : ServiceTest.LoginTest.MyTest(Google,Google)
System.Exception : System.IO.FileNotFoundException: Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at MySql.Data.MySqlClient.MySqlConnection.AssertPermissions()
   at MySql.Data.MySqlClient.MySqlConnection.Open()
   at DB.DBContext.Connect(DBSettingType dbSettingType) in C:\Users\user\git_projects\SomeProject\DB\DBContext.cs:line 38
   at DB.DBContext.Connect(DBSettingType dbSettingType) in C:\Users\user\git_projects\SomeProject\DB\DBContext.cs:line 43
   at DB.DBContext..ctor(DBSettingType dbSettingType) in C:\Users\user\git_projects\SomeProject\DB\DBContext.cs:line 26
   at SomeProjectLogic.Service.Login.Run(ReqLogin req, String ip) in C:\Users\user\git_projects\SomeProject\SomeProjectLogic\01_ServiceLogic\User\Login\Login.cs:line 34
   at ServiceTest.LoginTest.MyTest(DeviceType platformType, PlatformType socialType) in C:\Users\user\git_projects\SomeProject\ServiceTest\LoginTest.cs:line 45
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.GetResult()
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass4_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Run Settings
    DisposeRunners: |True|
    WorkDirectory: |C:\Users\user\git_projects\SomeProject\ServiceTest|
    ImageRuntimeVersion: |4.0.30319|
    ImageTargetFrameworkName: |.NETCoreApp,Version=v5.0|
    ImageRequiresX86: |False|
    ImageRequiresDefaultAppDomainAssemblyResolver: |False|
    TargetRuntimeFramework: |netcore-5.0|
    NumberOfTestWorkers: |16|

Test Run Summary
    Overall result: Failed
    Test Count: 1, Pass: 0, Fail: 1, Warn: 0, Inconclusive: 0, Skip: 0
        Failed Tests - Failures: 0, Errors: 1, Invalid: 0
    Start time: 2022-10-24 06:17:30Z
    End time: 2022-10-24 06:17:31Z
    Duration: 0.764 seconds

Results (nunit3) saved as TestResult.xml

@CharliePoole
Copy link
Collaborator

@OAguinagalde I assume you closed this issue by mistake.

You used version 4, which doesn't yet have the fix. You should use a version 3 drop, starting with 3.16.0-dev00043.

The version 4 releases come from main branch, while version 3 comes from version3. After the 3.16 release, I'll merge all the applicable patches to main so that the problems are fixed there as well.

@cw397
Copy link

cw397 commented Oct 25, 2022

A lot of different things have been discussed in this issue. Many have been solved and I would like to close it and create more narrow issues for what remains. There appear to be two remaining unclosed problems:

1. The problem with System.Security.Permissions not being found.

I believe that the fix to #1203 took care of this. @OAguinagalde can you verify using the MyGet release of the console runner? Version 3.16.0-dev00043 or a higher 3.16 version should have it.

2. The problem loading unmanaged libraries reported by @cw397

I haven't changed any code, which would effect this, so I'll make it a specific issue.

Have I missed anything in the discussion?

@CharliePoole I agree my issue is likely to have a separate underlying cause to the main one so am happy for you to make it its own issue. I think all the other issues are hopefully covered by your fix to #1203.

@OAguinagalde
Copy link
Author

@CharliePoole Sorry, my message was probably confusing with all the editing and stuff.

The log using version 4 was the original message, which I then edited after retrying with the version 3.16. I confirmed it working and edited the message, without removing the log using version 4... In any case. It is 100% working now! I have been using since yesterday and its great! Feel free to close the issue :)

@CharliePoole
Copy link
Collaborator

I'm closing this as (mostly) completed. The remaining problem is described in #1253

@CharliePoole CharliePoole self-assigned this Oct 26, 2022
@CharliePoole
Copy link
Collaborator

This issue has been resolved in version 3.16.0

The release is available on:
GitHub.
NuGet packages are also available NuGet.org and
Chocolatey Packages may be found at Chocolatey.org

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

3 participants