Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Package Reference no longer copied after being updated
Almoh
#1 Posted : Monday, November 30, 2020 5:54:21 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/30/2020(UTC)
Posts: 2
Location: France

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hello !

I'm facing an issue after the upgrade of a nuget dependency.

I'm using Specflow and the nuget SolidToken.SpecFlow.DependencyInjection to get dependency injection with the Microsoft IOC container.

After the upgrade of SolidToken.SpecFlow.DependencyInjection 0.4.0 to 0.6.0, the dll is not copied to the workspace anymore. This is an issue because Specflow won't load the plugin, as explained here.

What I can't explain though, is why it works with 0.4.0 and not with 0.6.0. The only thing I can find that might explain the change of behavior seems to be this PR. But that's just a guess.

With "Copy Referenced Assemblies To Workspace" enabled, it works again, as expected.

Can you please help me understanding why the behavior is different?

Here's some log from NCrunch that might help you.

Before the upgrade:

Quote:

ENGINE - [18:17:21.1983-ProcessOutputRedirectionErr-36] Process 28308: Processing TPA for deps entry [SolidToken.SpecFlow.DependencyInjection, 0.4.1, lib/netstandard2.0/SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll]
ENGINE - [18:17:21.1983-ProcessOutputRedirectionErr-36] Process 28308: Considering entry [SolidToken.SpecFlow.DependencyInjection/0.4.1/lib/netstandard2.0/SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll], probe dir [], probe fx level:0, entry fx level:0
ENGINE - [18:17:21.1983-ProcessOutputRedirectionErr-36] Process 28308: Local path query exists C:\Users\<redacted>\AppData\Local\NCrunch\21440\1\src\<redacted>.Testing\bin\QA\netcoreapp3.1\SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll
ENGINE - [18:17:21.1983-ProcessOutputRedirectionErr-36] Process 28308: Probed deps dir and matched 'C:\Users\<redacted>\AppData\Local\NCrunch\21440\1\src\<redacted>.Testing\bin\QA\netcoreapp3.1\SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll'
ENGINE - [18:17:21.1983-ProcessOutputRedirectionErr-36] Process 28308: Adding tpa entry: C:\Users\<redacted>\AppData\Local\NCrunch\21440\1\src\<redacted>.Testing\bin\QA\netcoreapp3.1\SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll, AssemblyVersion: 0.4.1.1, FileVersion: 0.4.1.0


After the upgrade:

Quote:

ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Processing TPA for deps entry [SolidToken.SpecFlow.DependencyInjection, 0.6.0, lib/netstandard2.0/SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll]
ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Considering entry [SolidToken.SpecFlow.DependencyInjection/0.6.0/lib/netstandard2.0/SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll], probe dir [], probe fx level:0, entry fx level:0
ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Local path query did not exist C:\Users\<redacted>\AppData\Local\NCrunch\21440\2\src\<redacted>.Testing\bin\QA\netcoreapp3.1\SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll
ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Skipping... not found in deps dir 'C:\Users\<redacted>\AppData\Local\NCrunch\21440\2\src\<redacted>.Testing\bin\QA\netcoreapp3.1\'
ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Skipping... not found in probe dir ''
ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Considering entry [SolidToken.SpecFlow.DependencyInjection/0.6.0/lib/netstandard2.0/SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll], probe dir [C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.9], probe fx level:1, entry fx level:0
ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Skipping... not found in deps json.
ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Skipping... not found in probe dir 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.9'
ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Considering entry [SolidToken.SpecFlow.DependencyInjection/0.6.0/lib/netstandard2.0/SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll], probe dir [C:\nuget\global-packages], probe fx level:-1, entry fx level:0
ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Relative path query exists C:\nuget\global-packages\solidtoken.specflow.dependencyinjection\0.6.0\lib\netstandard2.0\SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll
ENGINE - [18:21:26.6494-ProcessOutputRedirectionErr-35] Process 32252: Probed package dir and matched 'C:\nuget\global-packages\solidtoken.specflow.dependencyinjection\0.6.0\lib\netstandard2.0\SolidToken.SpecFlow.DependencyInjection.SpecFlowPlugin.dll'


A repro can be as little as:

Quote:


// Project.csproj

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

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

<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />

<!-- Copied to workspace -->
<PackageReference Include="SolidToken.SpecFlow.DependencyInjection" Version="0.4.0" />

<!-- Isn't copied to workspace -->
<!--<PackageReference Include="SolidToken.SpecFlow.DependencyInjection" Version="0.4.0" />-->

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0"/>
</ItemGroup>

</Project>

// UnitTest1.cs

using NUnit.Framework;

namespace NUnitTestProject1
{
public class Tests
{
[Test]
public void Test1()
{
Assert.Pass();
}
}
}




Thank you !
1 user thanked Almoh for this useful post.
mbhoek on 3/10/2021(UTC)
Remco
#2 Posted : Monday, November 30, 2020 11:52:22 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,976

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing these details.

It's difficult for me to give you a straight answer here as I am unfortunately unfamiliar with the internal workings of this package, and the unfathomable complexity of the netcore dependency resolution system makes it impossible to easily assess the entire workings of everything happening here.

Our experience with dependency injection systems is that they usually have their own resolution overrides that are implemented to resolve the dependencies at runtime. These are almost universally engineered under the assumption that assemblies are collocated in the build output directory, and will generally fail when they are not. We intended the 'Copy referenced assemblies to workspace' setting to cater for these sorts of scenarios, because we cannot code around all the implied logic in a world full of 3rd party libraries that were not built around our constraints.

I realise this is not the support answer you are hoping for, because as you said, the 0.4.0 package worked fine without this setting. Unfortunately, for us to help you establish the reason for this could take days of work, and the eventual solution would be the same: You need to turn on the 'Copy referenced assemblies to workspace' setting.
Almoh
#3 Posted : Tuesday, December 1, 2020 8:22:46 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/30/2020(UTC)
Posts: 2
Location: France

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi Remco.

Thanks for the response. I was indeed hoping you could help me find the "root cause", so I can discuss with the librairies owners. But I understand this would take too much time and isn't really worth the investment, considering I already have a way of bypassing it.

Have a nice day
mbhoek
#4 Posted : Wednesday, March 10, 2021 9:20:46 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 3/10/2021(UTC)
Posts: 1
Location: Netherlands

Thanks: 1 times
Was thanked: 3 time(s) in 1 post(s)
Hello,

SolidToken.SpecFlow.DependencyInjection package maintainer here.

Thanks to the excellent bug report by @Almoh I was able to fix this in v1.0.1.
This again enables the use of Microsoft.DependencyInjection as a DI framework for SpecFlow tests running in NCrunch (tested with v4.8).

Cheers!
3 users thanked mbhoek for this useful post.
Remco on 3/10/2021(UTC), upper on 3/12/2021(UTC), Almoh on 3/16/2021(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.074 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download