Dynamic Code Blocks

Microsoft Dynamics GP & .NET technical Blog by Tim Wappat

Eventargs "do not have a compatible signature”

After pulling a very large solution into smaller projects over the last da or two, a windows forms event handler that used to work, started complaining about the signature not matching for the event. A custom class inherited from EventArgs and added some properties for this event. The definition for the custom event argument resided in one of the class libraries that had been refactored.

To the eye and the intellisense tooltips the signatures looked identical. The break through was found by right clicking on one of the event arguments to “find definition” that lead to the class viewer rather than the code defining the class. This was a clue as this normally only happens when the source is not loaded in the IDE or the project is not holding a project reference, rather a file reference to the .dll of the class library in question.
Furthermore clicking the “find definition” on the other side of the event handler did lead to the source definition for the custom class.

I looked in the class viewer in visual studio and found two identical copies of the class in there. Somehow a cached version of the old .dll pre-refactor was still in the solution. After deleting the /obj and /bin contents for all projects and taking the references out and back in again, it all came back to life as it should.