reqnroll / Reqnroll

Open-source Cucumber-style BDD test automation framework for .NET.
https://reqnroll.net
BSD 3-Clause "New" or "Revised" License
302 stars 33 forks source link

Reqnroll.ReqnrollException: Unable to load plugin assembly #186

Closed YevheniiStepaniuk closed 1 week ago

YevheniiStepaniuk commented 2 weeks ago

Reqnroll Version

2.0.3

Which test runner are you using?

xUnit

Test Runner Version Number

2.4.3

.NET Implementation

.NET Core 3.1

Test Execution Method

Other – Rider

Content of reqnroll.json configuration file

No response

Issue Description

The issue appears intermittently on the CI only. The exception thrown is: Reqnroll.ReqnrollException: Unable to load plugin assembly: Microsoft.Extensions.DependencyModel.

Locally, everything works fine, and no issues are encountered.

Steps Taken to fix:

Error Log:

/tmp/.nuget/packages/reqnroll.tools.msbuild.generation/2.0.2/build/Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly. [/data/jenkins/workspace/lodgify-channels_PR-2322/Solution.Tests.Integration/Solution.Tests.Integration.csproj]

/tmp/.nuget/packages/reqnroll.tools.msbuild.generation/2.0.2/build/Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018: Reqnroll.ReqnrollException: Unable to load plugin assembly: /tmp/.nuget/packages/reqnroll.xunit/2.0.2/build/netstandard2.0/Reqnroll.xUnit.Generator.ReqnrollPlugin.dll. Please check https://go.reqnroll.net/doc-plugins for details. (Framework: .NET Core 3.1.32) [/data/jenkins/workspace/lodgify-channels_PR-2322/Solution.Tests.Integration/Solution.Tests.Integration.csproj]

/tmp/.nuget/packages/reqnroll.tools.msbuild.generation/2.0.2/build/Reqnroll.Tools.MsBuild.Generation.targets(93,5): error MSB4018:  ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. [/data/jenkins/workspace/lodgify-channels_PR-2322/Solution.Tests.Integration/Solution.Tests.Integration.csproj]

Additional Information:

The problem occurs only in the CI environment. Locally, the tests run without any issues. Request Any insights or solutions to resolve this intermittent CI failure would be greatly appreciated.

Steps to Reproduce

-

Link to Repro Project

No response

ajeckmans commented 2 weeks ago

Are you using 2.0.3 as stated in the issue report or 2.0.2 as stated in the error log? Could it be that you have two projects with differing versions?

YevheniiStepaniuk commented 2 weeks ago

@ajeckmans I tried both, 2.03 and downgraded to 2.0.2 to double check. issue appears in both unfortunately

gasparnagy commented 2 weeks ago

@YevheniiStepaniuk from the error message, it seems that the build on the CI is performed using the .NET Core 3.1 SDK. Could you please confirm this?

If yes, do you have any specific reasons to build using that SDK (you can target older frameworks also if you build with a newer SDK).

Probably locally you have a newer .NET SDK and this is why it works there.

You can check the installed SDKs by running the command dotnet --list-sdks.

YevheniiStepaniuk commented 1 week ago

Hello @gasparnagy, correct, we are using .NET Core 3.1 SDK. Locally I have .net8 installed but project still being targeted to the 3.1. Does it mean that Reqnroll has problems with 3.1?

gasparnagy commented 1 week ago

@YevheniiStepaniuk .NET Core 3.1 is out of support already by Microsoft since December 13, 2022 (see https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core) and Reqnroll also does not support it "officially" (see https://docs.reqnroll.net/latest/installation/compatibility.html#net-versions).

In practice, Reqnroll can most probably run tests with .NET Core 3.1 projects, but for compilation, you might need to use a newer .NET SDK.

So in short: if you need to keep your product compiled for .NET Core 3.1 for whatever reasons, you can do that, just make sure you compile it with a newer SDK. (The newer SDKs can compile to older ,NET versions without problems, so the .NET SDK version and the target version does not need to be the same.)

YevheniiStepaniuk commented 1 week ago

@gasparnagy Thanks for this information, really helpful