Extension methods and static methods mismatch prototype matching in c#
Having encountered a more advanced collision problem of extension and static methods I exemplified and simplified some code to:
    
    using System;

    namespace Test
    {
	static class EM
	{
		public static string To(this object o)
		{
			return "2222";
		}
	}
	class A
	{
		public static string To(){return "1111";}
	}
	class B{}
	
	class Program
	{
		public static void Main(string[] args)
		{
			Console.WriteLine("Hello World!");
			object o=null;
			o.To();
			B b=null;
			b.To();
			A a=null;
			a.To();
			A.To();
		}
	}
}

I got myself suprised when the .NET compilers, ranging from 3.x to 4.y failed to resolve which method should be called in the line where "a.To();" appears. Of course, I paraphrased the compiler but that's what the error message can be brought to (literally "Member 'Test.A.To()' cannot be accessed with an instance reference; qualify it with a type name instead"). I am posting this for not going into details of why the compiler alerts a programmer (already know the rules) but more to boost a discussion in what would be a near or final resolve to the problem of this certain kind (take into account inheritance) ahead of Microsoft, where a human can tell the extension/static method call matches easily, whereas the compiler even does not supply the exact programmer's mistake description or a hint.

Looking forward to hearing from 'stackoverflowers'.

Extension methods and static methods mismatch prototype matching in c#
===

Having encountered a more advanced collision problem of extension and static methods I exemplified and simplified some code to:
    
    using System;

    namespace Test
    {
	static class EM
	{
		public static string To(this object o)
		{
			return "2222";
		}
	}
	class A
	{
		public static string To(){return "1111";}
	}
	class B{}
	
	class Program
	{
		public static void Main(string[] args)
		{
			Console.WriteLine("Hello World!");
			object o=null;
			o.To();
			B b=null;
			b.To();
			A a=null;
			a.To();
			A.To();
		}
	}
}

I got myself suprised when the .NET compilers, ranging from 3.x to 4.y failed to resolve which method should be called in the line where "a.To();" appears. Of course, I paraphrased the compiler but that's what the error message can be brought to (literally "Member 'Test.A.To()' cannot be accessed with an instance reference; qualify it with a type name instead"). I am posting this for not going into details of why the compiler alerts a programmer (already know the rules) but more to boost a discussion in what would be a near or final resolve to the problem of this certain kind (take into account inheritance) ahead of Microsoft, where a human can tell the extension/static method call matches easily, whereas the compiler even does not supply the exact programmer's mistake description or a hint.

Looking forward to hearing from 'stackoverflowers'.
