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

Notification

Icon
Error

Analysis failure for generic fixture
GreenMoose
#1 Posted : Thursday, March 19, 2020 7:58:47 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 475

Thanks: 130 times
Was thanked: 62 time(s) in 60 post(s)
[NCrunch v4.3.0.13]
[NUnit v2.6.2]
[Bug Report Ref: D-1767]

After picking up an 1 year old legacy project, NCrunch fails to analyze 1 test project with error below:
Code:

NCrunch: This project was built on server '(local)'
NCrunch: The tests in this project were discovered on server '(local)'

An error occurred while analysing this project after it was built: System.NullReferenceException: Object reference not set to an instance of an object.
   at nCrunch.TestExecution.DiscoveredTestMember.GetDistributedCapabilities()
   at nCrunch.TestExecution.DefaultDiscoveredTestFactory.(FrameworkTest , ComponentUniqueName )
   at nCrunch.TestExecution.DefaultDiscoveredTestFactory.createTestsForFramework(Dictionary`2 discoveredTests, IEnumerable`1 tests, ComponentUniqueName testComponentUniqueName)
   at nCrunch.TestExecution.DefaultDiscoveredTestFactory.CreateDiscoveredTests(ReflectedAssembly assembly, IEnumerable`1 tests, ComponentUniqueName testComponentUniqueName)
   at nCrunch.TestExecution.TestFinder..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.TestExecution.TestFinder..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, DescribedTestFrameworkDiscoverer[] describedDiscoverers, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
   at nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(DescribedTestFrameworkDiscoverer[] applicableFrameworks, ComponentUniqueName testComponentUniqueName, PerfTracker perfTracker)


I have isolated it to a generic fixture, and NCrunch fails analysis when I have this fixture in the project, and succeeds if I remove the generic arguments:
Code:

    using NUnit.Framework;

    [TestFixture(TypeArgs = new[] { typeof(string) })]
    internal class SomeFixture<TOne>
    {
        [Test]
        public void SomeTest()
        {
        }
    }


Thanks.
GreenMoose
#2 Posted : Thursday, March 19, 2020 8:47:33 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 475

Thanks: 130 times
Was thanked: 62 time(s) in 60 post(s)
FWIW: It does not help if I upgrade to NUnit 2.7.1, but issue resolves when upgrading to NUnit 3.0. Unfortunately v3.0 has some breaking changes in this solution that causes us to remain on NUnit v2 (Work of upgrading to v3 was started a long time ago but then halted due to the workload involved).
Remco
#3 Posted : Thursday, March 19, 2020 10:27:08 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,982

Thanks: 781 times
Was thanked: 1008 time(s) in 960 post(s)
Good catch, thanks for sharing this! Does changing the framework utilisation type for NUnit allow you to work around the problem?
GreenMoose
#4 Posted : Thursday, March 19, 2020 11:33:25 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 475

Thanks: 130 times
Was thanked: 62 time(s) in 60 post(s)
Changing to StaticAnalysis voids the error but the test will not run with error message below:
Code:

NCrunch was unable to locate this test during NUnit's execution run. This problem can be caused by tests with names that contain random elements, such as through the use of NUnit's RandomAttribute. Please ensure your test is named consistently or consider changing your 'Framework utilisation type for NUnit' solution-level configuration setting to 'StaticAnalysis'.


I have however for now replaced the type parmeters with derived fixtures to get work going since it was only 18 instances.
1 user thanked GreenMoose for this useful post.
Remco on 3/19/2020(UTC)
Remco
#5 Posted : Friday, March 20, 2020 12:15:01 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,982

Thanks: 781 times
Was thanked: 1008 time(s) in 960 post(s)
I'm having trouble reproducing the issue you've reported with this code:



Code:

    using NUnit.Framework;

    [TestFixture(TypeArgs = new[] { typeof(string) })]
    internal class SomeFixture<TOne>
    {
        [Test]
        public void SomeTest()
        {
        }
    }


I'm testing with NUnit V2. It seems to work without exception under both static and dynamic analysis. Can you confirm whether this precise code sample fails on your end with the exception? Is there anything else I should be taking into consideration?
GreenMoose
#6 Posted : Friday, March 20, 2020 7:50:26 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 475

Thanks: 130 times
Was thanked: 62 time(s) in 60 post(s)
I am using target .net framework v4.5, but it also failed with newer ones. I have reproed it on 2 computers, you can find a repro sample (289kB) here: https://gofile.io/?c=IZSuup
Remco
#7 Posted : Monday, March 23, 2020 12:12:12 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,982

Thanks: 781 times
Was thanked: 1008 time(s) in 960 post(s)
GreenMoose
#8 Posted : Monday, March 23, 2020 9:57:57 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 475

Thanks: 130 times
Was thanked: 62 time(s) in 60 post(s)
Yes (incl. using UseDynamicAnalsys)! Thanks
1 user thanked GreenMoose for this useful post.
Remco on 3/23/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.043 seconds.