Bugzilla – Bug 314970
Overriden Properties, AddressOf, etc.
Last modified: 2007-09-15 21:24:23 UTC
---- Reported by jwezel@compumaster.de 2004-06-03 10:24:25 MST ---- Description of Problem: ======================= Compilation of the attached file works fine in MS.NET VBC, but not in MBAS: ' ------------------------------------------------------------------------- ----- ' <autogenerated> ' This code was generated by a tool. ' Mono Runtime Version: 1.1.4322.573 ' ' Changes to this file may cause incorrect behavior and will be lost if ' the code is regenerated. ' </autogenerated> ' ------------------------------------------------------------------------- ----- Option Explicit Off Option Strict On Imports Microsoft.VisualBasic Imports System Imports System.Collections Imports System.Collections.Specialized Imports System.Configuration Imports System.Text Imports System.Text.RegularExpressions Imports System.Web Imports System.Web.Caching Imports System.Web.Security Imports System.Web.SessionState Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.HtmlControls Namespace ASP Public Class index_aspx Inherits System.Web.UI.Page Implements System.Web.SessionState.IRequiresSessionState Private Shared __intialized As Boolean = False Private Shared __autoHandlers As Integer Public Sub New() If ((ASP.index_aspx.__intialized = False)) Then ASP.index_aspx.__intialized = True End If End Sub Protected Overrides Property AutoHandlers As Integer Get Return ASP.index_aspx.__autoHandlers End Get Set (Value As Integer) ASP.index_aspx.__autoHandlers = Value End Set End Property Protected ReadOnly Property ApplicationInstance As System.Web.HttpApplication Get Return CType(Me.Context.ApplicationInstance, System.Web.HttpApplication) End Get End Property Public Overrides ReadOnly Property TemplateSourceDirectory As String Get Return "/" End Get End Property Private Sub __RenderTree(__output As System.Web.UI.HtmlTextWriter, parameterContainer As System.Web.UI.Control) __output.Write("<html>"&Microsoft.VisualBasic.Strings.ChrW(10) &"<head><title>Test</title></head>"&Microsoft.VisualBasic.Strings.ChrW(10) &"<body>"&Microsoft.VisualBasic.Strings.ChrW(10)) __output.Write( "<h1>Hello world</h1>" ) __output.Write(""&Microsoft.VisualBasic.Strings.ChrW(10)) Response.Write ("This is a running VB website :))") __output.Write(""&Microsoft.VisualBasic.Strings.ChrW(10) &"<p>End of test.</p>"&Microsoft.VisualBasic.Strings.ChrW(10) &"</body>"&Microsoft.VisualBasic.Strings.ChrW(10) &"</html>"&Microsoft.VisualBasic.Strings.ChrW(10)) End Sub Private Sub __BuildControlTree(__ctrl As System.Web.UI.Control) '*** Should be corrected in ASP.NET Runtime respectively VBCogeGenerator to use AddressOf operator / JW/2004-06-03 '__ctrl.SetRenderMethodDelegate(New System.Web.UI.RenderMethod(Me.__RenderTree)) __ctrl.SetRenderMethodDelegate(AddressOf Me.__RenderTree) End Sub Protected Overrides Sub FrameworkInitialize() Me.TraceEnabled = True Me.TraceModeValue = System.Web.TraceMode.SortByTime Me.Request.ValidateInput() Me.__BuildControlTree(Me) End Sub Public Overrides Function GetTypeHashCode() As Integer Return 1821841690 End Function End Class 'Why is the indentation not working correctly here? --> see in mcs/class/System/Micrisoft.VisualBasic/VBCodeGenerator.cs 'Indent=0 End Namespace 'Indent=-1 One of the problems reside in line 42 ("Protected Overrides Property AutoHandlers As Integer") and not in line 52 as shown in the compiler message: [root@lwezel wwwroot]# mbas testsrc.vb.txt /r:Microsoft.VisualBasic.dll,System.dll,System.Web.dll,Syste m.Data.dll -------- MonoBASIC: THIS IS STILL ALPHA AND UNSUPPORTED SOFTWARE, USE AT YOUR OWN RISK. -------- testsrc.vb.txt(52,0) error BC30284: `ASP.index_aspx.AutoHandlers' no suitable properties found to override Compilation failed: 1 Error(s), 0 warnings [root@lwezel wwwroot]# I'd say, the property exists since in C# the ASP.NET generation is successfull. As I've seen, a second problem is the missing support of the AddressOf operator. But simply compile, you'll see... Steps to reproduce the problem: =============================== 1. Compile on MS.NET with P:\>vbc test.vb /r:Microsoft.VisualBasic.dll,System.dll,System.Web.dll,System.Data. dll /target:library 2. Try the same with mbas and it will fail because of several problems