[Mono-winforms-list] Bugzilla isn't working, so I'm posting this bug report for MWF

Rafael Teixeira monoman at gmail.com
Fri Jun 30 09:46:13 EDT 2006


People here in Brazil is experiencing it with the pre-packaged MWF
available to their distros, how recent was that keyboard code change?
Perhaps the bug doesn't happen anymore in SVN HEAD, but people may
want to know in which release the issue was solved.

Any info is welcome,

Thank,

On 6/30/06, Jackson Harper <jackson at ximian.com> wrote:
>
> Using an ABNT-2 keyboard layout I am unable to duplicate this crash.
> Also looking at the stack trace it looks like you are using an older
> version of the keyboard code.  The layout code is lazy now and should
> not load until you actually use the keyboard.  The stack you provided is
> crashing in initialization.
>
> Cheers,
> Jackson
>
> On Wed, 2006-06-28 at 12:03 -0300, Rafael Teixeira wrote:
> > **Description of Problem:
> >
> > When starting a WinForms application on a station with the ABNT2
> > (Brazilian 105-Key Keyboard) layout, we have a "Array index is out of
> > range." exception in <0x0043e>
> > System.Windows.Forms.X11Keyboard:CreateConversionArray that kills the
> > app.
> >
> > **Steps to reproduce the problem:
> > 1. Just run a SWF app, with that keyboard layout set on X11.
> >
> > **Actual Results:
> >
> > Unhandled Exception: System.TypeInitializationException: An exception
> > was thrown by the type initializer for System.Windows.Forms.XplatUI --->
> > System.IndexOutOfRangeException: Array index is out of range.
> > in <0x0043e> System.Windows.Forms.X11Keyboard:CreateConversionArray
> > (System.Windows.Forms.KeyboardLayouts layouts,
> > System.Windows.Forms.KeyboardLayout layout)
> > in <0x000d8> System.Windows.Forms.X11Keyboard:.ctor (IntPtr display,
> > IntPtr window)
> > in <0x003e9> System.Windows.Forms.XplatUIX11:SetDisplay (IntPtr
> > display_handle)
> > in <0x0008b> System.Windows.Forms.XplatUIX11:.ctor ()
> > in <0x00040> System.Windows.Forms.XplatUIX11:GetInstance ()
> > in <0x00061> System.Windows.Forms.XplatUI:.cctor ()--- End of inner
> > exception stack trace ---
> >
> > in <0x00000> <unknown method>
> > in <0x00064> System.Windows.Forms.Form:get_CreateParams ()
> > in <0x00273> System.Windows.Forms.Control:.ctor ()
> > in <0x00011> System.Windows.Forms.ScrollableControl:.ctor ()
> > in <0x00010> System.Windows.Forms.ContainerControl:.ctor ()
> > in <0x00019> System.Windows.Forms.Form:.ctor ()
> > in <0x00017> TestGUIWordCount.Form1:.ctor ()
> > in (wrapper remoting-invoke-with-check) TestGUIWordCount.Form1:.ctor ()
> > in <0x00018> TestGUIWordCount.Form1:Main ()
> >
> > **Expected Results:
> > Just showing the app form.
> >
> > **How often does this happen?
> >
> > Always for that keyboard layout.
> >
> > **Additional Information:
> >
> > This patch, deals with the exception so the app runs, and shows some
> > debugging information that may lead to the correct fix:
> >
> > Index: System.Windows.Forms/X11Keyboard.cs
> > ===================================================================
> > --- System.Windows.Forms/X11Keyboard.cs       (revision 61762)
> > +++ System.Windows.Forms/X11Keyboard.cs       (working copy)
> > @@ -497,14 +498,25 @@
> >                                                       }
> >                                               }
> >                                               if (maxval >= 0) {
> > -                                                     scan = layouts.scan_table [(int) layout.ScanIndex][maxval];
> > -                                                     vkey = layouts.vkey_table [(int) layout.VKeyIndex][maxval];
> > +                                                     try {
> > +                                                             scan = layouts.scan_table [(int) layout.ScanIndex][maxval];
> > +                                                             vkey = layouts.vkey_table [(int) layout.VKeyIndex][maxval];
> > +                                                     } catch (Exception e) {
> > +                                                             Console.WriteLine("Ignoring invalid indexes '{0}' '{1}'
> > '{2}'", (int) layout.ScanIndex, (int) layout.VKeyIndex, maxval);
> > +
> > +                                                             scan = 0;
> > +                                                             vkey = 0;
> > +                                                     }
> >                                               }
> >
> >                                       }
> >                               }
> > -                             keyc2vkey [e2.KeyEvent.keycode] = vkey;
> > -                             keyc2scan [e2.KeyEvent.keycode] = scan;
> > +                             if (e2.KeyEvent.keycode < 0 || e2.KeyEvent.keycode > 255)
> > +                                     Console.WriteLine("Ignoring invalid keycode found '{0}'",
> > e2.KeyEvent.keycode);
> > +                             else {
> > +                                     keyc2vkey [e2.KeyEvent.keycode] = vkey;
> > +                                     keyc2scan [e2.KeyEvent.keycode] = scan;
> > +                             }
> >                       }
> >
> >
>
>


-- 
Rafael "Monoman" Teixeira
---------------------------------------
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw


More information about the Mono-winforms-list mailing list