Method not found on release build

Lately, I encountered a slowdown in my website and already found the cause. The reason behind is because the methods in my DA layer has IEnumerable parameters instead of IQueryable. I already refactored the parameters in my DA and the solution was built successfully. However upon replacing the dll of DA in prod, the error method not found happened in the BL layer. The method it was looking for was the previous which has the IEnumerable parameter. Why am I encountering this when I built the code in my solution without fail?

NOTE: I did not replace any other dll except for the DA

Jon Skeet
people
quotationmark

Why am I encountering this when I built the code in my solution without fail?

Because you're rebuilding your BL project as well, presumably. That's fine - the method still exists by name, and the new parameter type is presuambly compatible with the argument you're passing, so your source still compiles.

But when you try replacing just your DA assembly, when your BL assembly code executes, it's still looking for a method with the IEnumerable parameter, but that method doesn't exist any more, hence the exception.

Simply put, changing a method parameter type is not a backwardly-compatible change, in terms of binary compatibility.

Just rebuild the whole project, and replace everything that depends on your DA assembly, as well as the DA assembly itself. Ideally, replace absolutely everything you build - that way you know that you've got a consistent set of assemblies.

people

See more on this question at Stackoverflow