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

Notification

Icon
Error

nCrunch and PostSharp
TURNSKIN
#1 Posted : Thursday, August 26, 2021 8:34:25 AM(UTC)
Rank: Member

Groups: Registered
Joined: 8/31/2015(UTC)
Posts: 16
Location: Lithuania

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Hi,
I am getting this error:
Quote:
Services.csproj (0, 0): The custom attribute 'Infrastructure.PostSharp.CheckUserPrivilegeAspectAttribute' constructor threw the exception FileNotFoundException: Could not load file or assembly 'nCrunch.TestRuntime.DotNetCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=01d101bf6f3e0aea'. The system cannot find the file specified.


How can I solve this issue?
TURNSKIN
#2 Posted : Thursday, August 26, 2021 10:48:33 AM(UTC)
Rank: Member

Groups: Registered
Joined: 8/31/2015(UTC)
Posts: 16
Location: Lithuania

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Code:
gacutil -i nCrunch.TestRuntime.DotNetCore.dll
gacutil /l nCrunch.TestRuntime.DotNetCore


Quote:
C:\Program Files\Microsoft Visual Studio\2022\Preview\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2022>gacutil /l nCrunch.TestRuntime.DotNetCore
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0
Copyright (c) Microsoft Corporation. All rights reserved.

The Global Assembly Cache contains the following assemblies:
nCrunch.TestRuntime.DotNetCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=01d101bf6f3e0aea, processorArchitecture=MSIL

Number of items = 1


but still the same issue occurs.
Remco
#3 Posted : Thursday, August 26, 2021 12:12:56 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi, thanks for sharing this issue.

This problem is occuring because postsharp is executing code that has been instrumented by NCrunch. The GAC workaround won't work in this scenario, probably because the environment used by Postsharp doesn't include the GAC in its search path.

Something you can try is to add a direct reference to the nCrunch.TestRuntime.DotNetCore.dll assembly from the project containing the instrumented code. This would cause the build system to copy the file to the build output directly where hopefully Postsharp can include it in its search path. To avoid making this a dependency for your non-NCrunch builds, you could make it conditional, for example:

<ItemGroup Condition="'$(NCrunch)' == '1'">
<Reference Include="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\Remco Software\NCrunch for Visual Studio 2019\nCrunch.TestRuntime.DotNetCore.dll" />
</ItemGroup>
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.027 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download