Thread: Odd build error
View Single Post
  #1 (permalink)  
Old 01-14-2009, 9:36 AM
Morcyk Morcyk is offline
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jan 2009
Posts: 2
Reputation: 0
Morcyk is on a distinguished programming path ahead
Default Odd build error

This issue may straddle more than just ASP .NET, but since it's an ASP .NET web site I'm having an issue with, here it is.

The environment: VB .NET, Framework 3.5, VS 2008, ASP .NET web site

The issue:
1. Building (Rebuilding too) the site results in the following error, but only in the output window (error list shows 0 errors, 0 warnings):
C:\Web\Default.aspx.vb(85,0): error BC30456: 'Drive' is not a member of 'Car'.
Validation Complete
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

2. The problem is, 'Drive' IS a member of 'Car'. Not only that, but if I hover over the 'Drive' method call on my instance in the IDE, it shows it as being a member of 'Car'. The 'Drive' method shows up in intellisense. I can even right click this "unknown" item and go to definition and it takes me to the spot that 'Drive' is defined. I've already tried restarting IIS and the computer with no luck. I'm at a loss on this one.

Here's the affected code.:

web (default.aspx):
<asp:Content ID="Content2" ContentPlaceHolderID="cphSiteData" Runat="Server">
<div class="cssDivCenter">
<asp:TextBox ID="txtMake" runat="server"></asp:TextBox>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_OnClick" />
</div>
</asp:Content>

click event (default.aspx.vb excerpt):
Public Sub btnSubmit_OnClick(ByVal sender As Object, ByVal e As EventArgs)
Dim myCar As New Car()

'THIS IS THE LINE THE ERROR IS THROWN ON
If Not myCar.Drive() Then
'Do Something
End If
End Sub

class & interface data:
Public Interface IVehicle
Function Drive() As Boolean
End Interface

Public MustInherit Class Vehicle
Implements IVehicle

Public MustOverride Function Drive() As Boolean Implements IVehicle.Drive
End Class

Public Class Car
Inherits Vehicle

Public Overrides Function Drive() As Boolean
Dim retVal As Boolean = True

Try
'Do something
Catch ex As Exception
'exception
End Try
Return retVal
End Function
End Class
Reply With Quote