Test error in Visual Studio 2017 RRS feed

  • Question

  • I am getting an error when I try to run a test.  The solution builds but gets the following error when I try to run the test:

    System.MissingMethodException: Method not found: 'Int32 Int32 DataAccessMVC.Interfaces.IDb2DataAccessWrapper.ExecuteNonQuery(System.String, System.String, System.Collections.Generic.IEnumerable`1<IBM.Data.DB2.DB2Parameter>, System.String)'.

    IDb2DataAccessWrapper is a method that was added.  Can you help me?

    Tuesday, January 15, 2019 2:22 PM

All replies

  • Sounds like your unit test project isn't referencing all the same assemblies that your regular app (MVC?) is.

    Michael Taylor

    Tuesday, January 15, 2019 2:59 PM
  • Hi DBullard1958,

    Thank you for posting here.

    For your question, what is the type of your project?

    If your question is more related to MVC, you could post a new thread in MVC forum for suitable support.

    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, January 16, 2019 5:23 AM
  • It is a web ui project.  This is one of the tests.  Some changes were made so that the methods that access the DB2 data could be tested.  Our coverage was lacking and failing SonarCube.  I don't think this is an MVC issue.  Could be???  The interesting thing is that they only fail on a select few of the pc's.

    Wednesday, January 16, 2019 7:47 PM
  • Could be a referencing issue.

    1. Is DataAccess.Mvc.Interfaces a library that your apps reference via NuGet or by copying binaries around or is it a project in the solution?
    2. Is your unit test project using the same version of the framework as your MVC project?
    3. Are you multi-targeting your application or is this a .NET Framework app?
    4. Do you have binding redirects in your web.config? Are those same redirects in your app.config of your unit test project?
    5. If you compare the binary in the output directory of your MVC app to the output directory of your unit test project are they identical?

    My gut instinct is that you have an older version of the assembly being referenced in your code somewhere. Because of the build process your unit test is getting the wrong version of the assembly dropped into its output directory.

    Michael Taylor

    Wednesday, January 16, 2019 7:54 PM