[Mono-bugs] [Bug 75933][Nor] New - System.Windows.Forms: message_filters not being initialized

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Aug 29 16:14:09 EDT 2005

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 eric at rengeo.com.


--- shadow/75933	2005-08-29 16:14:09.000000000 -0400
+++ shadow/75933.tmp.11566	2005-08-29 16:14:09.000000000 -0400
@@ -0,0 +1,99 @@
+Bug#: 75933
+Product: Mono: Class Libraries
+Version: 1.0
+OS: SUSE 9.2
+OS Details: 
+Status: NEW   
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: eric at rengeo.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: System.Windows.Forms: message_filters not being initialized
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+Using daily tar archive of mono (mono-, There seems to be an
+error when using AddMessageFilter()In application.cs under
+System.Windows.Forms.  I have repeated it in earlier versions of the daily
+tar archive as well.  It looks like the variable message_filters is null
+and isn't being intialized as a result of the Application() constructor not
+being called when the program runs.  
+Adding a simple:
+if(message_filters == null)
+   message_filters = new ArrayList()
+Will correct this problem, but throws a bunch of errors in other places. 
+Besides, that's pretty much just a hack.  The root of the problem is that
+the Application() constructor isn't being called, as I can put a print
+message in there, rebuild mono, and NEVER see it output when I run my program.
+I will attach a test case I whipped up, that demonstrates this.  The
+attached code does compile and run fine under Visual C# .NET
+Steps to reproduce the problem:
+1. Extract the files contained in the tar archive.  the .resources file is
+already created, and the program just needs to be compiled.
+2. To make it easier, I use the environment variable WINFORMS_DIR, so
+double check that when you export this variable, it doesn't already exist.
+ This is used to reference the System dll files for mono.  For me, I set
+the directory to:
+printenv WINFORMS_DIR
+3. change to the directory the files were decompressed into, and compile with:
+mcs -out:./WindowsApplication1.exe -noconfig+ -warn:4 -target:winexe
+-debug+ -define:DEBUG -reference:$WINFORMS_DIR/System.dll
+"/resource:./Form1.resources" "./Form1.cs"
+4. Run application with:
+mono WindowsApplication1.exe
+Actual Results:
+I have print statements I put in my mono in order to track down the
+problem, in case questions arise as to my output.  The first non-standard
+line says we're entering the AddMessageFilter() function, the second line
+is testing if value is being passed correctly and the 3rd line is testing
+message_filters for null.
+Mono System.Windows.Forms Assembly [Revision: 44786; built: 2005/5/25 22:34:45]
+Keyboard: United States keyboard layout (phantom key version)
+---------------->IN Add MessageFilter
+value = WindowsApplication1.Form1, Text: Form1
+message_filters == null!  OH NOEZ
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in [0x00068] (at
+System.Windows.Forms.Application:AddMessageFilter (IMessageFilter value)
+in [0x0001d] (at
+WindowsApplication1.Form1:.ctor ()
+in (wrapper remoting-invoke-with-check) WindowsApplication1.Form1:.ctor ()
+in [0x00000] (at
+WindowsApplication1.Form1:Main ()
+val----------- System.Windows.Forms.en.resources 
+val----------- System.Windows.Forms.resources 
+Expected Results:
+A Windows.Forms Window that says "YAY" in the top-middle.
+How often does this happen? 
+Every time
+Additional Information:

More information about the mono-bugs mailing list