pengweiqhca / Xunit.DependencyInjection

Use Microsoft.Extensions.DependencyInjection to resolve xUnit test cases.
MIT License
370 stars 49 forks source link

v8.8.0 is failing with FileNotFoundException #89

Closed iamdmitrij closed 1 year ago

iamdmitrij commented 1 year ago

Latest version Xunit.DependencyInjection is failing with exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Sample project of usage: https://github.com/iamdmitrij/Tethos/blob/main/demo/FakeItEasy/Tethos.Xunit.Demo/Startup.cs

Perhaps this is related to recent commit?

[xUnit.net 00:00:00.27] Tethos.Xunit.Demo: Catastrophic failure: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

File name: 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Xunit.DependencyInjection.DisposableExtensions.DisposeAsync(IDisposable disposable)
   at Xunit.DependencyInjection.HostManager.Dispose()
   at Xunit.Sdk.DisposalTracker.Dispose() in /_/src/xunit.execution/Sdk/DisposalTracker.cs:line 29
   at Xunit.Sdk.TestFrameworkExecutor`1.Dispose() in /_/src/xunit.execution/Sdk/Frameworks/TestFrameworkExecutor.cs:line 72
   at DisposableExtensions.SafeDispose(IDisposable disposable) in /_/src/xunit.runner.utility/Extensions/DisposableExtensions.cs:line 8
   at Xunit.Xunit2.Dispose() in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2.cs:line 86
   at Xunit.XunitFrontController.Dispose() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 155
   at Xunit.Runner.VisualStudio.VsTestRunner.RunTestsInAssembly(IRunContext runContext, IFrameworkHandle frameworkHandle, LoggerHelper logger, TestPlatformContext testPlatformContext, RunSettings runSettings, IMessageSinkWithTypes reporterMessageHandler, AssemblyRunInfo runInfo) in /_/src/xunit.runner.visualstudio/VsTestRunner.cs:line 584
The active test run was aborted. Reason: Test host process crashed : Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at Xunit.DependencyInjection.DependencyInjectionTestMethodRunner.RunTestCaseAsync(IXunitTestCase testCase)
   at Xunit.Sdk.TestMethodRunner`1.RunTestCasesAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestMethodRunner.cs:line 136
   at Xunit.Sdk.TestMethodRunner`1.RunAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestMethodRunner.cs:line 106
   at Xunit.Sdk.TestClassRunner`1.RunTestMethodsAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestClassRunner.cs:line 213
   at Xunit.Sdk.TestClassRunner`1.RunAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestClassRunner.cs:line 171
   at Xunit.Sdk.TestCollectionRunner`1.RunTestClassesAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestCollectionRunner.cs:line 130
   at Xunit.Sdk.TestCollectionRunner`1.RunAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestCollectionRunner.cs:line 101
   at Xunit.Sdk.XunitTestAssemblyRunner.RunTestCollectionsAsync(IMessageBus messageBus, CancellationTokenSource cancellationTokenSource) in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTestAssemblyRunner.cs:line 205
   at Xunit.Sdk.TestAssemblyRunner`1.RunAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestAssemblyRunner.cs:line 196
   at Xunit.DependencyInjection.DependencyInjectionTestFrameworkExecutor.RunTestCases(IEnumerable`1 testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
pengweiqhca commented 1 year ago

Fix https://github.com/pengweiqhca/Xunit.DependencyInjection/commit/32d03524275a1140311403d0ab8ff51d3a571b40

iamdmitrij commented 1 year ago

@pengweiqhca thanks! Works fine now.