C# woes - "call is ambiguous between the following methods" - identical methods

Oh the irony. An ambiguous message about ambiguous methods. As you'll notice, the conflicting method names are the exact same:

Error 48 The call is ambiguous between the following methods or properties: 'Ecommerce.Core.Helpers.DateTimeHelpers.Verify(System.DateTime?)' and 'Ecommerce.Core.Helpers.DateTimeHelpers.Verify(System.DateTime?)' C:\Ecommerce\Ecommerce.Core\Helpers\DateTimeHelpers.cs 9 24 Ecommerce.Core

The issue here was that my Ecommerce.Core project was referencing itself. Yes, you heard that right. At first I assumed I was responsible but upon closer inspection it looks like Visual Studio or a Visual Studio plugin was responsible for automatically adding the reference...

I removed the reference and, voila, the error (actually hundreds of errors for various methods) disappeared. I don't mean this in a cynical way, but I would legitimately like to know if there are any valid use cases for a project referencing itself.

Post a Comment

Popular posts from this blog

Getting Started with Mirth (Part 2)

Mirth

Visual Studio 2012–Debug in Chrome Incognito Mode