Coder Perfect

Method not found? System.MissingMethodException

Problem

The following error is now thrown by the previously working asp.net webforms app:

It should work because the DoThis method is on the same class.

As such, I have a generic handler:

public class MyHandler: IHttpHandler
{
    public void Processrequest(HttpContext context)
    {
      // throws error now System.MissingMethodException: 
      // Method not found.
      this.DoThis(); 
    }

    public void DoThis(){ ... }
}

Asked by user603007

Solution #1

This is a problem that can occur if an old version of a DLL is still present. Verify that the most recent assemblies are deployed, and that no duplicated older assemblies are hidden in specific directories. The best course of action is to delete all built items and rebuild/redeploy the complete solution.

Answered by Polity

Solution #2

Nuget Package Version Is Incorrect

I had a unit test project that was bringing in our company’s internal EF Nuget data access package, however the code was pulling in an external package whose version was many versions behind the current one.

The problem was that the top-level package’s Nuget settings were set to the newest version, which meant that the lower-level/older version won and was used during the operations….

As a result, it discreetly installed the incorrect version of a shared assembly that is used by both the package and the program.

💡 Solution 💡

The issue was resolved by setting/updating the package in Nuget to utilize and [get] the newest.

Answered by ΩmegaMan

Solution #3

I fixed the problem by installing the correct version of the.NET Framework on the server. The website was built for version 4.0, but the assembly it was calling was built for version 4.5. Everything works properly after installing.NET Framework 4.5 and upgrading the website to version 4.5.

Answered by Ben Gripka

Solution #4

I was able to resolve the issue by restarting Visual Studio. I believe it was caused by old assembly files remaining in use, and a “Clean Build” or restarting Visual Studio should resolve the issue.

Answered by Jelani

Solution #5

Check your References!

Make sure you’re pointing to the same 3rd-party libraries across all of your solutions projects (don’t just trust versions; look at the path).

If you use iTextSharp v.1.00.101 in one project and NuGet or reference iTextSharp v1.00.102 in another, you’ll encounter these types of runtime issues.

Everything worked once I adjusted the references to iTextSharp in all three projects to point to the same DLL.

Answered by Juls

Post is based on https://stackoverflow.com/questions/8058832/system-missingmethodexception-method-not-found