Unit test in Unity - Getting InvalidCastException - Why? And how to fix it?

I try to be as specific and useful as possible in my questions here at SO, but for that, well, it means almost nothing, because I have absolutely no hint of how this happens.

This happens on any / every test (even "empty"). And I already tried (uninstalling and) updating unity. - Does not work.

In any case, here is the exception stop code:

2017.11.16 14:54:24.308   ERROR System.Reflection.TargetInvocationException: Uma exceção foi acionada pelo destino de uma chamada.
System.Reflection.TargetInvocationException: Uma exceção foi acionada pelo destino de uma chamada. ---> System.InvalidCastException: Não é possível converter um objeto do tipo 'NUnit.Engine.CallbackHandler' no tipo 'System.Web.UI.ICallbackEventHandler'.
   em NUnit.Framework.Api.FrameworkController.LoadTestsAction..ctor(FrameworkController controller, Object handler)
   --- Fim do rastreamento de pilha de exceções internas ---
   em System.RuntimeMethodHandle._InvokeConstructor(Object[] args, SignatureStruct& signature, IntPtr declaringType)
   em System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   em System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   em System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
   em System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
   em System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
   em System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
   em NUnit.Engine.Drivers.NUnit3FrameworkDriver.Load(String testAssemblyPath, IDictionary`2 settings)
   em NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
   em NUnit.Engine.Runners.AbstractTestRunner.Load()
   em NUnit.Engine.Runners.MasterTestRunner.LoadPackage()
   em NUnit.Engine.Runners.AbstractTestRunner.EnsurePackageIsLoaded()
   em NUnit.Engine.Runners.MasterTestRunner.NUnit.Engine.ITestRunner.Explore(TestFilter filter)
   em JetBrains.ReSharper.UnitTestRunner.nUnit30.BuiltInNUnitRunner.<>c__DisplayClass1.<RunTests>b__0()
   em JetBrains.ReSharper.UnitTestRunner.nUnit30.BuiltInNUnitRunner.WithExtensiveErrorHandling(IRemoteTaskServer server, Action action)

This has been giving me quite a bit of code without (unit-) testing over the past few days, so if anyone has an idea of ​​the cause and / or solutions, it will be very helpful.

+4
source share
1 answer

Resharper NUnit Engine . , .NET 2.0 4.5. , , .NET. , , System.Web.UI.ICallbackEventHandler.

Test Explorer, NUnit 3 VS.

...

, nunit, . .

System.Web.UI.ICallbackEventHandler (.NET 2.0, 3.5, 4.0 4.5), (.NET Standard 1.3 1.6) . NUnit , , . , , .

, , Microsoft. , . , - /, , , .

, Unity .

+2

Source: https://habr.com/ru/post/1689402/


All Articles