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

Notification

Icon
Error

NCrunch can't build projects that use generic attributes
yusuf
#1 Posted : Friday, December 9, 2022 6:56:21 AM(UTC)
Rank: Member

Groups: Registered
Joined: 11/7/2019(UTC)
Posts: 13

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
Code to reproduce:

Code:
namespace ConsoleApp1;

[AttributeUsage(AttributeTargets.All)]
public class TestAttribute<T> : Attribute
{
}

[Test<string>]
public class Program
{
    public static void Main()
    {
    }
}


Error message:

Code:
NCrunch has encountered an internal error: System.Exception: nCrunch.Compiler.StaticManipulation.CilTypeHashException: Unable to hash type 'ConsoleApp1.Program' due to exception: System.NotSupportedException: TypeSpec
   at nCrunch.Compiler.Cil.Methods.CilMemberReference.GetReferencedTypeImpactId()
   at nCrunch.Compiler.Cil.CustomAttributes.CilCustomAttribute..(CilMemberReference )
   at nCrunch.Compiler.Cil.CustomAttributes.CilCustomAttribute.[T](Func`2 , Func`2 )
   at nCrunch.Compiler.Cil.CustomAttributes.CilSortedCustomAttributeEnumerator.MoveNext()
   at nCrunch.Compiler.StaticManipulation.CilMethodHashGenerator.HashType(FNV64& hash, CilTypeDefinition type)
   at nCrunch.Compiler.StaticManipulation.BuiltCilAssembly.ExtractClassMethodData(TestFrameworkDescription[] applicableTestFrameworks, IDictionary`2 codeFileIDsByForegroundFilePath, Boolean storeImpactHashes)
   at nCrunch.Compiler.StaticManipulation.BuiltCilAssembly.ExtractClassMethodData(TestFrameworkDescription[] applicableTestFrameworks, IDictionary`2 codeFileIDsByForegroundFilePath, Boolean storeImpactHashes)
   at nCrunch.Compiler.CilProcessingTasks.CilMethodHashingTask..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Compiler.CilProcessingTasks.ConcurrentCilTaskProcessor.()
   at nCrunch.Compiler.CilProcessingTasks.ConcurrentCilTaskProcessor.ProcessTasks(Int32 backgroundThreadsAllowed)
   at nCrunch.Compiler.RemoteBuildRunner.(ComponentInstrumentationParameters , BuildOutput , IBackgroundTaskProcessor )
   at nCrunch.Compiler.RemoteBuildRunner.PerformPostProcessingOfBuiltAssembly(ComponentInstrumentationParameters instrumentationParameters, BuildOutput output, IBackgroundTaskProcessor backgroundTaskProcessor)
   at nCrunch.Core.BuildManagement.BuildEnvironment..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents, GridClientId gridClientId, IList`1 customEnvironmentVariables, IPlatformBuildExtender extender, Guid taskId, GridAddress clientAddress, Boolean extractCoverageReportStructure)
Remco
#2 Posted : Friday, December 9, 2022 11:17:59 PM(UTC)
Rank: NCrunch Developer

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

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

I actually didn't know this was possible. We'll implement a fix for this in the next release. Thanks for bringing it to my attention.
Remco
#4 Posted : Wednesday, December 14, 2022 10:19:25 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
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.034 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download