I have a COM object that works fine in VB.NET, but not in C#. Both projects are .NET 4 console applications.
The COM object loads in C#, but the methods don't return any values. Why would it work in VB.NET and not C#?
Thanks!
Sub Main()
Dim server As New NoahVersionLib.Version
Dim val As Int32
server.GetNoahServerVersionMS(val)
End Sub
static void Main(string[] args)
{
var server = new NoahVersionLib.Version();
int val= 0;
server.GetNoahServerVersionMS(ref val);
}
val is 0 in the C# build, but has a value in the VB.NET build.
UPDATE:
I needed to put [STAThread] on my Main() in C#. It works now.
ildasm. Do you see a difference in the generated IL code? If yes, what is it?