I'm asking in case I'm missing something obvious, but I think I may have stumbled upon a bug in .NET's compiler.
I have two projects in a .NET solution, one visual basic, one C#.
C# code, consisting of three overloaded static methods with default values:
public static class Class1
{
public static void TestFunc(int val1, int val2 = 0)
{
}
public static void TestFunc(int val1 = 0)
{
}
public static void TestFunc(string val1, int val2 = 0)
{
}
}
Visual basic code, calling one of the overloaded methods:
Option Explicit On
Option Strict On
Imports ClassLibrary1
Module Module1
Sub Main()
Dim x As Integer
Class1.TestFunc(x, 0)
End Sub
End Module
Compiling this code will fail, saying:
'TestFunc' is ambiguous because multiple kinds of members with this name exist in class 'ClassLibrary1.Class1'.
Why would it see this method as ambiguous? There is only one Class1.TestFunc with an (int, int) signature. Is this a bug, or am I missing something?