[Mono-bugs] [Bug 374663] New: Setting MdiParent crashes with Unhandled Exception

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Mar 28 00:34:21 EDT 2008


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


           Summary: Setting MdiParent crashes with Unhandled Exception
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: i686
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: charles.goodwin at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Third Party Developer/Partner


This problem is encountered when trying to run FreeTrain
(http://freetrain.sourceforge.net/) - an open source .NET game we are porting
to Mono.  The source can be found here:
http://freetrain.svn.sourceforge.net/svnroot/freetrain/branches/FreeTrainSDL

Using MonoDevelop 1.0, running FreeTrain using the instructions found here:
http://freetrain.sourceforge.net/forum/viewtopic.php?f=6&t=21


When running FreeTrain the game screen briefly shows before it crashes and
exits immediately .  The cause of the crash is setting MdiParent on a Form,
used to manage the child windows for the game.  Commenting out each MdiParent
assignment (there are several in the offending block of code) causes the crash
to move to the next MdiParent assignment.  Comment them all out and the game
runs without crashing.

Example:

            mainWindowMDI = new MainWindowMDI();

            mainWindowMDI.Show();

            RailRoadController.create();

            RailRoadController.theInstance.Hide();

            RailRoadController.theInstance.MdiParent = mainWindowMDI;
            // never reaches here

            RailRoadController.theInstance.WindowState =
FormWindowState.Maximized;

            RailRoadController.theInstance.Show();

The exception:

Unhandled Exception: System.InvalidCastException: Cannot cast from source type
to destination type.
  at System.Windows.Forms.MdiClient.ActivateChild (System.Windows.Forms.Form
form) [0x00045] in
/usr/src/redhat/BUILD/mono-1.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs:702 
  at System.Windows.Forms.MdiClient.set_ActiveMdiChild
(System.Windows.Forms.Form value) [0x00000] in
/usr/src/redhat/BUILD/mono-1.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs:953 
  at (wrapper remoting-invoke-with-check)
System.Windows.Forms.MdiClient:set_ActiveMdiChild (System.Windows.Forms.Form)
  at System.Windows.Forms.MdiClient+ControlCollection.Add
(System.Windows.Forms.Control value) [0x00049] in
/usr/src/redhat/BUILD/mono-1.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs:81 
  at System.Windows.Forms.Form.set_MdiParent (System.Windows.Forms.Form value)
[0x00079] in
/usr/src/redhat/BUILD/mono-1.9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:923 
  at (wrapper remoting-invoke-with-check)
System.Windows.Forms.Form:set_MdiParent (System.Windows.Forms.Form)
  at FreeTrain.FreeTrainSDL.Go () [0x0050e] in
/home/charles/Games/svn/FreeTrainSDL/Program.cs:432 
  at FreeTrain.FreeTrainSDL.Main () [0x00006] in
/home/charles/Games/svn/FreeTrainSDL/Program.cs:319 

System information:

Fedora 8 (up to date), uninstalled Fedora Mono (1.2.5, not current enough to
run FreeTrain) and installed Mono 1.9 from the OpenSuSE Mono repo for yum:

[charles at localhost jin-2.14.1]$ cat /etc/yum.repos.d/mono.repo
[Mono Stack]
baseurl=http://download.opensuse.org/repositories/Mono/Fedora_8/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/Mono/Fedora_8/repodata/repomd.xml.key
disabled=no
type=rpm-md

[Mono_Community]
name=Mono Community (Fedora_8)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/Mono:/Community/Fedora_8/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/Mono:/Community/Fedora_8/repodata/repomd.xml.key
disabled=no


[mono rhel]
name=Mono Stack (RHEL_5)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/Mono/RHEL_5/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/Mono/RHEL_5/repodata/repomd.xml.key
disabled=no


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


More information about the mono-bugs mailing list