[Mono-bugs] [Bug 434591] New: Mono crashes in runtime while creating and accessing dynamic controls e.g. buttons

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Oct 12 08:33:32 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=434591


           Summary: Mono crashes in runtime while creating and accessing
                    dynamic controls e.g. buttons
           Product: Mono: Runtime
           Version: 2.0
          Platform: x86
        OS/Version: Windows XP
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: sakkalis at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Development


The following code demonstrates that mono crashes when trying to access a
button text that was created dynamically.

The same code running without the mono execution in .NET is executing perfectly
and the button text is appearing correctly. I am attaching a VB code the
replicates the problem. The code was written and compiled in VisualStudio 2008.
(two buttons are attached in a Form: Button1 and btnTest). The sender argument
does not deliver the text correctly when in Mono running mode.

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
        MessageBox.Show(sender.text)
    End Sub

    Private Function AddButton(ByVal Text As String) As Button
        Dim btnNew As New Button
        Static iCount As Integer = 1
        Dim btn As Button
        btn = Button1

        btnNew.Left = btn.Left + iCount * (btn.Width + 10)
        btnNew.Top = btn.Top
        btnNew.Width = btn.Width
        btnNew.Height = btn.Height

        btnNew.Text = Text

        AddHandler btnNew.Click, AddressOf Button1_Click
        iCount += 1
        Return (btnNew)
    End Function

    Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnTest.Click
        Me.Controls.Add(AddButton("One"))
        Me.Controls.Add(AddButton("Two"))
        Me.Controls.Add(AddButton("Three"))
    End Sub
End Class


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list