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

Notification

Icon
Error

Failed to resolve assembly: DurableTask
coghlans
#1 Posted : Wednesday, August 26, 2020 2:13:45 PM(UTC)
Rank: Member

Groups: Registered
Joined: 7/26/2012(UTC)
Posts: 12
Location: United Kingdom

Thanks: 2 times
Code:
..\..\..\..\..\..\..\..\source\repos\Float\.nuget\microsoft.net.sdk.functions\3.0.9\build\Microsoft.NET.Sdk.Functions.Build.targets (32, 5): Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.WebJobs.Extensions.DurableTask, Version=2.0.0.0, Culture=neutral, PublicKeyToken=014045d636e89289'
   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name)
   at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
   at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
   at Mono.Cecil.ModuleDefinition.Resolve(TypeReference type)
   at Mono.Cecil.TypeReference.Resolve()
   at MakeFunctionJson.AttributeExtensions.IsWebJobsAttribute(CustomAttribute attribute)
   at MakeFunctionJson.ParameterInfoExtensions.<>c.<IsWebJobSdkTriggerParameter>b__0_0(CustomAttribute a)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at MakeFunctionJson.ParameterInfoExtensions.IsWebJobSdkTriggerParameter(ParameterDefinition parameterInfo)
   at MakeFunctionJson.MethodInfoExtensions.<>c.<HasTriggerAttribute>b__4_0(ParameterDefinition p)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at MakeFunctionJson.MethodInfoExtensions.HasTriggerAttribute(MethodDefinition method)
   at MakeFunctionJson.MethodInfoExtensions.HasValidWebJobSdkTriggerAttribute(MethodDefinition method)
   at MakeFunctionJson.FunctionJsonConverter.GenerateFunctions(IEnumerable`1 types)+MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at MakeFunctionJson.FunctionJsonConverter.TryGenerateFunctionJsons()
   at MakeFunctionJson.FunctionJsonConverter.TryRun()
Error generating functions metadata

..\..\..\..\..\..\..\..\source\repos\Float\.nuget\microsoft.net.sdk.functions\3.0.9\build\Microsoft.NET.Sdk.Functions.Build.targets (32, 5): Metadata generation failed.


NCrunch 4.4.0.12
VisualStudio Pro 16.7.2


Relevant chunk from csProj file:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>1701;1702;AD0001</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EFCore.BulkExtensions" Version="3.1.5" />
<PackageReference Include="Google.Protobuf" Version="3.13.0" />
<PackageReference Include="Microsoft.Azure.DurableTask.AzureStorage" Version="1.7.7" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.18" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.6" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.2.2" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask.Analyzers" Version="0.3.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.7" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.9" />
</ItemGroup>
Remco
#2 Posted : Thursday, August 27, 2020 12:56:44 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for sharing this issue.

I've had a go at reproducing it, but it seems to be dependent on code within the project in addition to the Nuget packages.

Have you tried enabling the 'Copy referenced assemblies to workspace' setting for this project? It appears as though the build task is designed to only work when the dependencies are collocated.
coghlans
#4 Posted : Thursday, August 27, 2020 6:36:51 AM(UTC)
Rank: Member

Groups: Registered
Joined: 7/26/2012(UTC)
Posts: 12
Location: United Kingdom

Thanks: 2 times
I think it is because I have a `nuget.config` for this solution, and it redirects the nugets to a different location (i.e. not windows user default)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value=".nuget" />
</config>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
Remco
#5 Posted : Thursday, August 27, 2020 8:29:05 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Sadly that didn't trigger it on my end, but looking at that stack trace, I'm fairly certain this is a collocation issue. Does the setting resolve the problem?
coghlans
#6 Posted : Friday, August 28, 2020 6:38:52 AM(UTC)
Rank: Member

Groups: Registered
Joined: 7/26/2012(UTC)
Posts: 12
Location: United Kingdom

Thanks: 2 times
Didn't trigger:
Probably because your Dev machine already has the packages in the default user location..

I'll try that setting (If I can find it ;-)
coghlans
#7 Posted : Friday, August 28, 2020 7:02:10 AM(UTC)
Rank: Member

Groups: Registered
Joined: 7/26/2012(UTC)
Posts: 12
Location: United Kingdom

Thanks: 2 times
Found the setting ;-)
No some do not even compile due to the following:

Quote:

NCrunch was unable to restore Nuget packages required to build a test environment for this solution, due to an unspecified failure when invoking 'msbuild.exe /t:restore'

The following packages do not exist under the Nuget packages folder for the active user profile, yet they have been flagged by NCrunch as potentially needed for normal operation. NCrunch has attempted to restore these files via an MSBuild restore step, which has either failed or not returned the expected result. It's possible that these packages may not be needed for building projects or running tests in your environment. If you experience downstream problems with NCrunch on this solution, it is recommended you restore or download the packages manually.

Note that the restore of packages may fail if NCrunch is being hosted under a windows account that does not have sufficient rights to store files in the Nuget packages directory.xunit.abstractions v2.0.3
xunit.runner.utility v2.4.1
coghlans
#3 Posted : Friday, August 28, 2020 7:20:23 AM(UTC)
Rank: Member

Groups: Registered
Joined: 7/26/2012(UTC)
Posts: 12
Location: United Kingdom

Thanks: 2 times
Remco;14940 wrote:
Hi, thanks for sharing this issue.

I've had a go at reproducing it, but it seems to be dependent on code within the project in addition to the Nuget packages.

Have you tried enabling the 'Copy referenced assemblies to workspace' setting for this project? It appears as though the build task is designed to only work when the dependencies are collocated.



This did not solve the build issue. :-(
Remco
#8 Posted : Saturday, August 29, 2020 12:46:27 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
To make sure this isn't a dependency issue, could you try turning the 'Copy referenced assemblies to workspace' setting on for all the projects in your solution?

Can you check whether the Microsoft.Azure.WebJobs.Extensions.DurableTask assembly is being stored in the same build output directory as your assembly that is experiencing the build error? You can navigate to this by right clicking the failed project in the NCrunch tests window, then choosing Advanced->Browse to workspace.

Also, see here for some workarounds that people have used to get the Azure function projects running under NCrunch - https://forum.ncrunch.net/yaf_postst2767_Azure-Function---build-issue.aspx. Note that we don't officially support these project types. We have performed no proper testing of NCrunch over them and have no integration in place to handle them.
coghlans
#9 Posted : Monday, September 7, 2020 8:45:18 AM(UTC)
Rank: Member

Groups: Registered
Joined: 7/26/2012(UTC)
Posts: 12
Location: United Kingdom

Thanks: 2 times
Remco;14949 wrote:
To make sure this isn't a dependency issue, could you try turning the 'Copy referenced assemblies to workspace' setting on for all the projects in your solution?

Did that - No Change

Remco;14949 wrote:
Can you check whether the Microsoft.Azure.WebJobs.Extensions.DurableTask assembly is being stored in the same build output directory as your assembly that is experiencing the build error? You can navigate to this by right clicking the failed project in the NCrunch tests window, then choosing Advanced->Browse to workspace.

Did not display anything !

Remco;14949 wrote:
Also, see here for some workarounds that people have used to get the Azure function projects running under NCrunch - https://forum.ncrunch.net/yaf_postst2767_Azure-Function---build-issue.aspx. Note that we don't officially support these project types. We have performed no proper testing of NCrunch over them and have no integration in place to handle them.

These just made it worse.

Seems like I will have to give up on NCrunch (Again) until:
1) Support for building Blazor apps
2) Support for Blazor testing via BUnit
3) Support for Azure Functions builds
4) Support for running functions locally (No Azure) via mocking and NUnit
5) A way to ignore an NCrunch failing build - get a project to build normally - and include it for other dependencies to use (i.e. unblock the "Not Built" status)
Remco
#10 Posted : Monday, September 7, 2020 1:53:45 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
I'm sorry that we couldn't find a way to get this to work for you.

Please understand that we are only a two person team, and maintaining out of the box support for every project type produced by MS (with its thousands of developers) just isn't possible for us. Presently, we don't have support out of the box for Azure based projects (nor do we claim to), as we need to carefully consider which toolsets we have the capacity to handle reliably.

Despite this, I had held some hope that it would be possible to at least have you operating with a workaround, so I persisted with trying further to help you rather than just offer a standard 'not supported' answer. Some users have managed to get NCrunch working on Azure projects, though I cannot vouch for what kind of experience they've had.

Presently we have no plans to support BUnit. You are welcome to place a feature request for this if you like. It doesn't look as though anyone has requested this to date.

Ignoring failed project builds is sadly not an option for us as to do this would involve integration with the foreground solution in a manner that could cause erratic behaviour and interference with the IDE. Implementing a background test runner unfortunately means accepting some limitations and this is one of them.

Apologies for your clear frustration and the expense of your time.
1 user thanked Remco for this useful post.
coghlans on 9/11/2020(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.097 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download