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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          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.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to