The NUnit 3 driver encountered an error while executing reflected code (NUnit.Engine.NUnitEngineException)

Viewed 3984

I have a simple Nunit project which contains only a single test. I want to execute my code using command, so I have installed ‘Nunit-console.exe’ on my Windows 10 machine. After installation, executed the code on command prompt using below command

nunit3-console.exe "G:\LiveProjects\NUnitTestProject2\NUnitTestProject2\bin\Debug\netcoreapp3.1\NUnitTestProject2.dll"
like so

After executing this command, I have discovered below error message:

NUnit.Engine.NUnitEngineException : The NUnit 3 driver encountered an error while executing reflected code.
  ----> System.InvalidCastException : Unable to cast transparent proxy to type 'System.Web.UI.ICallbackEventHandler'.
--NUnitEngineException
The NUnit 3 driver encountered an error while executing reflected code.
like so

Please refer my below code:

[TestFixture]   
    public class Tests
    {
        [SetUp]
        public void Setup()
        {

            Console.WriteLine("Welcome setup");

        }

        [Test]
        public void Test1()
        {
          
            Console.WriteLine("Welcome first Test ");
            Assert.Pass();
        }
    }
like so

Configuration details of my project:

  1. Microsoft.NET Framework version 4.7.0
  2. OS: window 10
  3. IDE: Visual studio 2019
  4. Use Nunit framework for unit testing
  5. NUnit3TestAdapter (Version) 3.16.1
  6. Microsoft.NET.Test.Sdk (Version) 16.5.0
  7. NUnit.Console (Version) 3.11.1
  8. Target .NET framework (Version) 3.1

Also, I have tried to disable the ‘code coverage’ option in visual studio 2019, however - I am not able to see it in. Can anyone suggest - where is ‘code coverage’ option available in visual studio 2019.

3 Answers
Related