this wont be easy to explain clearly but here goes…
i have something that works fine in VB but not in C#.
i have 2 classes, each class implements a different interface. each interface exposes an Initialize() function that should get called automatically when the plugin loads. since each class has an Initialize() function, i can watch both functions get called in the log. this works fine in VB.
when i do this same thing in C#, only the Initialize() in the first class gets called. anyone have a clue as to why this might be happening?
vb code:
Public Class class1
Implements Interface1
Public Sub Initialize() Implements Interface1.Initialize
msgbox("initialize from class1")
End Sub
End Class
Public Class class2
Implements Interface2
Public Sub Initialize() Implements Interface2.Initialize
msgbox("initialize from class2")
End Sub
End Class
C# code:
public class class1 : interface1
{
public void Initialize()
{
messagebox.show("initialize from class1");
}
}
public class class2 : interface2
{
public void Initialize()
{
messagebox.show("initialize from class2");
}
}
as you can see the code is identical in both languages. why does it work in VB and not in C#?
Thanks everyone for your help! It turns out the problem was in the calling code. Long story short, each plugin has a command ID as part of the interface. In this case both have ID 1000. When the calling code loops through plugins to load, if it sees a duplicate ID it skips that plugin. My problem was that I was loading other plugins at the same time with the same ID. You all helped find a bug in the calling code (which is pretty well-known software) so thank you!