[Mono-bugs] [Bug 77871][Wis] New - Null reference exception on TopMost

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Mar 22 05:04:47 EST 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by marines_one at tiscali.fr.

http://bugzilla.ximian.com/show_bug.cgi?id=77871

--- shadow/77871	2006-03-22 05:04:47.000000000 -0500
+++ shadow/77871.tmp.4541	2006-03-22 05:04:47.000000000 -0500
@@ -0,0 +1,131 @@
+Bug#: 77871
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: Gentoo 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: marines_one at tiscali.fr               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Null reference exception on TopMost
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+if you use the TopMost property on Winform you get a
+System.NullReferenceException: Object reference not set to an instance of
+an object
+
+
+Steps to reproduce the problem:
+1. 
+Use this code :
+
+using System;
+using System.Windows.Forms;
+
+class MainClass : Form
+{
+	public static void Main(string[] args)
+	{
+		Application.Run(new MainClass());
+	}
+	
+	public MainClass()
+	{
+		this.Load += new System.EventHandler(this.OnLoad);
+	}
+	
+	
+	public void OnLoad(object o, System.EventArgs e)
+	{
+		Form2 f2 = new Form2();
+		f2.Owner = this;
+		
+		f2.ShowDialog();
+		
+	}
+	
+}
+
+Form2.cs :
+using System;
+using System.Windows.Forms;
+
+public class Form2 : Form
+{
+
+	MainClass main;
+
+	public Form2()
+	{
+		this.Load += new System.EventHandler(this.OnLoad);
+	}
+	
+	public void OnLoad(object o, System.EventArgs e)
+	{
+		main = (MainClass)this.Owner;
+		this.TopMost = true;
+	}
+
+}
+
+
+2. Compil and run
+3. 
+
+Actual Results:
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in [0x0003f] (at
+/home/vincent/telecharger/mono_src/svn/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs:3885)
+System.Windows.Forms.XplatUIX11:SetTopmost (IntPtr handle, IntPtr
+handle_owner, Boolean enabled)
+in [0x00008] (at
+/home/vincent/telecharger/mono_src/svn/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs:755)
+System.Windows.Forms.XplatUI:SetTopmost (IntPtr handle, IntPtr hWndOwner,
+Boolean Enabled)
+in [0x0005f] (at
+/home/vincent/telecharger/mono_src/svn/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:706)
+System.Windows.Forms.Form:set_Owner (System.Windows.Forms.Form value)
+in (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:set_Owner
+(System.Windows.Forms.Form)
+in [0x00008] (at /home/vincent/Projects/testWinform/testWinform/Main.cs:23)
+MainClass:OnLoad (System.Object o, System.EventArgs e)
+in (wrapper delegate-invoke)
+System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
+in [0x00013] (at
+/home/vincent/telecharger/mono_src/svn/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:1374)
+System.Windows.Forms.Form:OnLoad (System.EventArgs e)
+in [0x00067] (at
+/home/vincent/telecharger/mono_src/svn/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs:1328)
+System.Windows.Forms.Form:OnCreateControl ()
+in [0x00075] (at
+/home/vincent/telecharger/mono_src/svn/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:2571)
+System.Windows.Forms.Control:CreateControl ()
+in [0x0000c] (at
+/home/vincent/telecharger/mono_src/svn/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs:3072)
+System.Windows.Forms.Control:Show ()
+in (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:Show ()
+in [0x00028] (at
+/home/vincent/telecharger/mono_src/svn/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:313)
+System.Windows.Forms.Application:RunLoop (Boolean Modal,
+System.Windows.Forms.ApplicationContext context)
+in [0x00007] (at
+/home/vincent/telecharger/mono_src/svn/mono/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs:292)
+System.Windows.Forms.Application:Run (System.Windows.Forms.Form mainForm)
+in [0x00005] (at /home/vincent/Projects/testWinform/testWinform/Main.cs:10)
+MainClass:Main (System.String[] args)
+
+
+Additional Information:
+
+Mono version : svn head (2006/03/22 )


More information about the mono-bugs mailing list