Lazycoder

10Aug/040

More bad errors in VB.NET IDE

Ugh, everytime I try to use VB.NET I’m struck with how hard the VB.NET IDE is to use. So I’m building a PlugIn handler, basing my code off of Roy’s excellent article. I have an interface in C# that looks like this.

public interface IPluginHandler
{
void HandlePlugin(IPlugin plugin, IPluginContext context);
}

I’m trying to implement it in a VB.NET base page.
Public Class BasePage
Inherits System.Web.UI.Page
Implements IPluginHandler

Public Sub HandlePlugin(ByVal plugin As IPlugin, ByVal context As IPluginContext) Implements IPluginHandler.HandlePlugin

End Sub

End Class

All is groovy in code land unless I change my ByVal keywords to ByRef

Public Sub HandlePlugin(ByRef plugin As IPlugin, ByRef context As IPluginContext) Implements IPluginHandler.HandlePlugin

What error do you think I get when the code BG compiles? If you guessed ” ‘HandlePlugin’ cannot implement ‘HandlePlugin’ because there is no matching sub on interface ‘IPluginHandler’.” You win. It took me a few minutes to ponder this. Thankfully I have 10 years of dealing with Microsoft Errors behind me and I realized that there was probably something wrong with the signature. The Compiler really needs more robust contextual compiler errors. In this case it knew that I was trying to implement that particular method and could have told me something to the effect that the method signatures do not match rather than telling me that there is no matching sub on the interface. The error is obscured by the language used to describe it.

Filed under: General Leave a comment