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

Notification

Icon
Error

Build failed on Unity project
networm
#1 Posted : Wednesday, October 4, 2017 5:32:31 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/4/2017(UTC)
Posts: 4

Was thanked: 2 time(s) in 2 post(s)
Environment:
Unity 2017.1.1f1
Visual Studio Community 2017 15.3.5
Windows 10 Pro 10.0.15063

These are release versions and update-to-date until today 2017/10/4.

Step
1. Create a new project using Unity
2. Create a script file in Assets directory and a test script in Assets/Editor directory.
3. Unity Menu > Assets > Open C# Project
4. VS Menu > NCrunch > Enable NCrunch
5. VS Menu > NCrunch > Tests
6. See the build log

Log
Analysis failure
Quote:

An error occurred while analysing this project after it was built: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Unable to cast object of type 'nCrunch.Module.NUnit3.Integration.NUnit3CallbackProxy' to type 'System.Web.UI.ICallbackEventHandler'.
at NUnit.Framework.Api.FrameworkController.LoadTestsAction..ctor(FrameworkController controller, Object handler)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
at System.RuntimeMethodHandle.InvokeConstructor(Object[] args, SignatureStruct signature, RuntimeTypeHandle declaringType)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at nCrunch.Module.NUnit3.Integration.FrameworkController.LoadTests(INUnit3CallbackHandler handler)
at nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor.<prepareFramework>b__7_0()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackActivity(String name, Action activity)
at nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor.prepareFramework(DynamicProxy[] dynamicProxies)
at nCrunch.Module.NUnit3.Integration.NUnit3FrameworkInteractor..ctor(ReflectedAssembly assembly, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, DynamicProxy[] dynamicProxies)
at nCrunch.Module.NUnit3.Integration.NUnit3FrameworkRuntimeEnvironment.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
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)


Other Information
NUnit is embedded in Unity and project generated by Unity is referencing it.
Look at nunit dll we could see its version is 3.5.0.0 at "C:\Program Files\Unity\Editor\Data\UnityExtensions\Unity\TestRunner\net35\unity-custom\nunit.framework.dll".
And NUnit version is 3.5.0.0 in generated project too.

I wnat to use NCrunch to work with Unity. There are a lot of game developer using Unity. Would NCrunch add support for Unity for a persistent schedule?
Remco
#2 Posted : Wednesday, October 4, 2017 6:15:52 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 930 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for sharing this problem.

I've seen this problem reported before a few months ago. I can't remember if it was also a unity project, but the problem originated from the nunit.framework.dll file. For some reason, this NUnit binary wasn't an officially released version of NUnit3, and it had critical code that was fundamentally incompatible with the normal NUnit API.

If this is the same problem, updating the binary to the latest version of NUnit should solve this. Non-release versions of NUnit cannot be supported by NCrunch unfortunately.
networm
#3 Posted : Wednesday, October 4, 2017 6:19:12 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/4/2017(UTC)
Posts: 4

Was thanked: 2 time(s) in 2 post(s)
Thanks for your reply. I will try to using official NUnit instead to see if problem solved.
networm
#4 Posted : Tuesday, October 17, 2017 11:50:23 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/4/2017(UTC)
Posts: 4

Was thanked: 2 time(s) in 2 post(s)
I have created a Unity plugin to solve this problem the day when I posted this problem.

And I also tried to submit it to Unity Asset Store, but its status is still Pending Review until right now.
I just want to post it after it has been approved, but I can't wait now.

Here is the plugin: networm/NCrunchAdapterForUnity: Fix NCrunch didn't work in project generated by Unity.
Its license is MIT License. Hope it will be helpful for anyone else.
1 user thanked networm for this useful post.
Remco on 10/18/2017(UTC)
networm
#5 Posted : Wednesday, October 25, 2017 12:44:45 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/4/2017(UTC)
Posts: 4

Was thanked: 2 time(s) in 2 post(s)
NCrunch Adapter For Unity - Asset Store

NCrunch Adapter For Unity has been accept by Unity Asset Store finally.
If you have any questions, please reply.
1 user thanked networm for this useful post.
Remco on 10/25/2017(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.044 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download