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

Microsoft.Toolkit.Mvvm v7.1.1 will freeze NUnit tests #14

Closed
4 of 21 tasks
jozefizso opened this issue Nov 9, 2021 · 6 comments
Closed
4 of 21 tasks

Microsoft.Toolkit.Mvvm v7.1.1 will freeze NUnit tests #14

jozefizso opened this issue Nov 9, 2021 · 6 comments
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior

Comments

@jozefizso
Copy link

Describe the bug

After upgrading Microsoft.Toolkit.Mvvm to v7.1.1 from v7.0.2 out unit tests are failing because their freeze after executing every test in the project. We use NUnit 4 to run tests. The problem is reproducible locally and on Azure Pipelines build machines.

  • Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work: v7.0.2

Steps to Reproduce

We don't have a sample app as this is a proprietary software. We have application which uses Microsoft.Toolkit.Mvvm package and we have another unit tests project using NUnit.

Steps to reproduce the behavior:

  1. Upgrading Microsoft.Toolkit.Mvvm to v7.1.1
  2. Run unit tests using Visual Studio Test Explorer
  3. Wait for tests to finish.

Observe all tests were finished but Test Explorer reports tests are still running. This error is logged in the console:

Exception NUnit.Engine.NUnitEngineUnloadException,    Exception thrown unloading tests from C:\dev\ProjectA\tests\ProjectA.Tests\bin\Debug\ProjectA.Tests.dll
Unable to unload application domain: unload thread timed out after 30 seconds.
Application domain was unloaded before all details could be read.

   at NUnit.Engine.Services.DomainManager.DomainUnloader.Unload()
   at NUnit.Engine.Runners.TestDomainRunner.UnloadPackage()
   at NUnit.Engine.Runners.AbstractTestRunner.Unload()
   at NUnit.Engine.Runners.MasterTestRunner.UnloadPackage()
   at NUnit.Engine.Runners.MasterTestRunner.Unload()
   at NUnit.VisualStudio.TestAdapter.NUnitEngine.NUnitEngineAdapter.CloseRunner() in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\NUnitEngineAdapter.cs:line 128
   at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, IGrouping`2 testCases, TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 305
NUnit Adapter 4.0.0.0: Test execution complete
An exception occurred while invoking executor 'executor://nunit3testexecutor/': Exception encountered unloading application domain
Stack trace:
   at NUnit.Engine.Services.DomainManager.DomainUnloader.Unload()
   at NUnit.Engine.Runners.TestDomainRunner.UnloadPackage()
   at NUnit.Engine.Runners.AbstractTestRunner.Unload()
   at NUnit.Engine.Runners.MasterTestRunner.UnloadPackage()
   at NUnit.Engine.Runners.MasterTestRunner.Unload()
   at NUnit.VisualStudio.TestAdapter.NUnitEngine.NUnitEngineAdapter.CloseRunner() in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\NUnitEngineAdapter.cs:line 128
   at NUnit.VisualStudio.TestAdapter.NUnitEngine.NUnitEngineAdapter.Dispose() in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitEngine\NUnitEngineAdapter.cs:line 132
   at NUnit.VisualStudio.TestAdapter.NUnitTestAdapter.Unload() in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnitTestAdapter.cs:line 320
   at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 205
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithTests.InvokeExecutor(LazyExtension`2 executor, Tuple`2 executorUri, RunContext runContext, IFrameworkHandle frameworkHandle)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.<>c__DisplayClass48_0.<RunTestInternalWithExecutors>b__0()
   at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.<>c__DisplayClass0_0.<Run>b__0()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(Action action, PlatformApartmentState apartmentState, Boolean waitForCompletion)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.TryToRunInSTAThread(Action action, Boolean waitForCompletion)
   at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTestInternalWithExecutors(IEnumerable`1 executorUriExtensionMap, Int64 totalTests)

Inner exception: Exception encountered unloading application domain: Attempted to access an unloaded appdomain. (Exception from HRESULT: 0x80131014)
Application domain was unloaded before all details could be read.

Expected behavior

There should be no errors when NUnit tries to unload the app domain.

Environment

NuGet Package(s): 7.1.1

Windows 10 Build Number:

  • Fall Creators Update (16299)
  • April 2018 Update (17134)
  • October 2018 Update (17763)
  • May 2019 Update (18362)
  • May 2020 Update (19041)
  • Insider Build ({build_number})

App min and target version:

  • Fall Creators Update (16299)
  • April 2018 Update (17134)
  • October 2018 Update (17763)
  • May 2019 Update (18362)
  • May 2020 Update (19041)
  • 21H1 Update (19043)
  • Insider Build ({build_number})

Device form factor:

  • Desktop
  • Xbox
  • Surface Hub
  • IoT

Visual Studio version:

  • 2017 (15.{minor_version})
  • 2019 (16.11.5)
  • 2022 (17.{minor_version})
@ghost
Copy link

ghost commented Nov 9, 2021

Hello jozefizso, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@michael-hawker
Copy link
Member

FYI @Sergio0694

@Sergio0694
Copy link
Member

Sergio0694 commented Nov 9, 2021

@jozefizso Are your tests running on .NET Framework?
If so, this is a known issue (seems the same as #12), which I have fixed already (not in this repo).
@michael-hawker We might want to consider pushing another hotfix with this 🤔

For future reference: we would need to cherry pick e2b3361 from the new repo.

@michael-hawker
Copy link
Member

@Sergio0694 I know we discussed just releasing an update from the new repo with some other fixes, so may be best to use that as a test maybe? Let's talk about it more at the start of next week after .NET Conf?

@jozefizso
Copy link
Author

@Sergio0694 yes, we use .NET Framework 4.6.2. We run VSTest with NUnit runner 4.

@Sergio0694 Sergio0694 transferred this issue from CommunityToolkit/WindowsCommunityToolkit Nov 11, 2021
@Sergio0694
Copy link
Member

Closing this was e2b3361 fixed it, it will be available in a future release 😊

@Sergio0694 Sergio0694 added the bug 🐛 An unexpected issue that highlights incorrect behavior label Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior
Projects
None yet
Development

No branches or pull requests

3 participants