[Mono-winforms-list] NullReferenceException calling SWF.Control.set_AccessibleRole

Jackson Harper jackson at ximian.com
Wed Aug 30 14:06:31 EDT 2006


Please DO NOT post decompiled code to this, or any other mono related
list.


On Wed, 2006-08-30 at 10:50 -0700, Nick Thorpe wrote:
> I did some digging through the Infragistics code that I mentioned in
> my first e-mail and I do not see any class that overrides
> AccessibleObject. This UltraToolBarsDockArea extends and abstract
> called UltraControlBase, which itself extends SWF.Control. Neither of
> the Ultra classes overrides the Accessibility methods.
> 
> The InitControlStyles method that results in the NullRef exception is
> more or less doing this:
> 
>       if (!base.DesignMode)
>       { 
>             if (this.isPopupArea)
>             {
>                   base.AccessibleRole = AccessibleRole.MenuPopup;
>             }
>             else
>             {
>                   base.AccessibleRole = AccessibleRole.Grouping;
>             }
>       }
> 
> In .NET 1.1 that should go to:
> 
> public AccessibleRole AccessibleRole
> {
>       set
>       {
>             if (!Enum.IsDefined(typeof(AccessibleRole), value)) 
>             {
>                   throw new InvalidEnumArgumentException("value",
> (int) value, typeof(AccessibleRole));
>             }
>             this.Properties.SetInteger(Control.PropAccessibleRole,
> (int) value); 
>       }
> }
> 
> But in MWF.Control, as I'm sure you know, it's doing:
> 
> public AccessibleRole AccessibleRole {
>             set {
>                 AccessibilityObject.role=value;
>             }
> 
> That doesn't look like a problem unless the AccessibleObject is for
> some reason not getting initialized before the set. 
> 
> I also tried running this on Mono 1.1.6 and it basically gave me the
> same exception with the addition of:
> 
> in (wrapper stfld) System.Object:__stfld_wrapper_System.Int32
> (object,intptr,intptr,intptr,int)
> 
> I don't know enough about the Mono code to say whether that is
> meaningful, although I do wonder if the AccessibleRole property has a
> problem with the value.
> 
> If you have any thoughts on additional things I can look at or
> additional data I can provide please let me know. At this point this
> appears to be an incompatibility with Mono, but I certainly don't have
> enough evidence to say there's a bug here. 
> 
> Thanks,
> Nick
> 
> 
> On 8/28/06, Rafael Teixeira <monoman at gmail.com> wrote:
>         Looking at our code, I would say that the only chance of
>         happening a
>         null reference error is if the control that
>         UltraToolbarsDockArea is
>         trying to set the AccessibleRole (presumbaly itself) redefines
>         (overrides) the method: 
>         
>                 protected virtual AccessibleObject
>         CreateAccessibilityInstance() {
>                                 return new
>         Control.ControlAccessibleObject(this);
>                 }
>         
>         With one that is not able to return a new
>         AcessibleObject-compatible 
>         instance, for some other cause.
>         
>         Good luck,
>         
>         On 8/24/06, Nick Thorpe <nt at zrho.com> wrote:
>         > Hi all,
>         >
>         > I'm trying to get a 3rd party GUI library (Infragistics
>         NetAdvantage) 
>         > working with Mono 1.1.16.1. When I run our application it
>         dies almost
>         > instantly with this exception:
>         >
>         >  Unhandled Exception: System.NullReferenceException: Object
>         reference not 
>         > set to an instance of an object
>         >   at System.Windows.Forms.Control.set_AccessibleRole
>         > (AccessibleRole value) [0x00000]
>         >   at
>         >
>         Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.InitControlStyles 
>         > () [0x00000]
>         >   at
>         >
>         Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea..ctor
>         > () [0x00000]
>         >   at (wrapper remoting-invoke-with-check)
>         >
>         Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea:.ctor 
>         > ()
>         >   at PSOMA.Form1.InitializeComponent () [0x00000]
>         >   at PSOMA.Form1..ctor () [0x00000]
>         >   at (wrapper remoting-invoke-with-check) PSOMA.Form1:.ctor
>         ()
>         >   at PSOMA.Form1.Main () [0x00000] 
>         >
>         > I checked the CIL to see if the library was using something
>         outside of .NET,
>         > but it looks pretty standard and is seems to be failing at
>         this call:
>         >
>         >   IL_0098:  call       instance void 
>         >
>         [System.Windows.Forms]System.Windows.Forms.Control::set_AccessibleRole(valuetype
>         > [System.Windows.Forms]System.Windows.Forms.AccessibleRole)
>         >
>         > I don't know enough about SWF to say whether this is a bug,
>         or if these 
>         > libraries are doing something unsupported. If anyone has any
>         input on the
>         > problem I'd appreciate it.
>         >
>         > Thanks,
>         > Nick
>         >
>         > 
> 
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list
-- 
Novell, Inc. 
SUSE® Linux Enterprise 10
Your Linux is ready
www.novell.com/linux 





More information about the Mono-winforms-list mailing list