I have a common project called common. Inside is a class called ExtensionMethods which is used by legacy applications. I want to break apart the class into multiple files, but keep the name the same. So instead of public static class ExtensionMethods {}
I have many public static partial class ExtensionMethods {}
.
When I drop the new dll created from the partial classes, I am getting a Method not found:
exception by one of the legacy applications using the dll. What is causing this? Is the filename infomation embedded in the dll somehow? Do partial classes make the old and new dll incompatible? What's the deal? The dll is not versioned, and we are not using the gac. It's just a simple dll placed in the same directory as the exe.
Update:
Thank you everyone for the suggestions so far. Here's what I've checked so far
same namespace: check.
same signatures: check.
still public: check.
I can build the legacy app and it builds without error.
Yes, the exception tells me what method it is. Method not found:
'System.Collections.Generic.IEnumerable\`1<!!0> CompanyName.Common.ExtentionMethods.Distinct(System.Collections.Generic.IEnumerable\`1<!!0>, System.Func\`3<!!0,!!0,Boolean>)'.
(Sadly, the misspelling of 'Extension' is the way it is in the code.)
I will begin using some tools suggested by you all to look further.
Answer: User error. The dll I thought I copied wasn't the new dll I thought I was building. I can't figure if it was a rebuild that was needed or a source control problem or just my mistake. Anyways, both answers below were correct, partial classes wasn't the problem, and both answers were helpful, but in the end, I think it was the reflector solution that lead me to finding the problem. Thanks everyone.
Partial classes are a compiler trick, nothing more - there's no meaningful difference in the final assembly.
So, I think that your actual problem lies elsewhere.
Check the details of the exception you're getting and review the source for that particular method.
Also, grab an inspection tool like Reflector or dotPeek to search for the class/method in the assembly itself and you should find the problem fairly quickly.