Hey,
We have a grid with editors per cell. on a few computers, at one point, the users are getting the following error:
System.NullReferenceException: Object reference not set to an instance of an object.
at Infragistics.Win.ValueListDropDownAppearanceManager.ResolveValueListItemAppearance(ValueListItemUIElement valueListItemElement, AppearanceData& appData, AppearancePropFlags requestedProps)
at Infragistics.Win.ValueListItemUIElement.InitAppearance(AppearanceData& appearance, AppearancePropFlags& requestedProps)
at Infragistics.Win.ValueListItemUIElement.PositionChildElements()
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)
at Infragistics.Win.UIElement.VerifyChildElements(Boolean recursive)
at Infragistics.Win.ControlUIElementBase.VerifyIfElementsChanged(Boolean verify, Boolean syncMouseEntered)
at Infragistics.Win.ControlUIElementBase.ProcessMouseHover(Object sender, EventArgs e)
at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
at Infragistics.Win.UltraControlBase.OnMouseHover(EventArgs e)
at System.Windows.Forms.Control.WndProc(Message& m)
at Infragistics.Win.ValueListDropDownUnsafe.WndProc(Message& message)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Thanks,
Mano
By looking at the code (using reflection on Infragistics4.Win.v11.1.dll and Infragistics4.Win.v13.1.dll) it appears that the function is prone to null reference.
public void ResolveValueListItemAppearance(ValueListItemUIElement valueListItemElement, ref AppearanceData appData, AppearancePropFlags requestedProps) { ValueListItem valueListItem = (valueListItemElement != null) ? valueListItemElement.ValueListItem : null; if (valueListItemElement != null) { //removed for brievity. } AppearanceData resolvedAppearance = ValueList.GetResolvedAppearance(valueListItem, valueListItem.ValueList, requestedProps); AppearanceData.Merge(ref appData, ref resolvedAppearance, ref requestedProps); }
the function GetResolvedAppearance is passing the 2nd parameter as valueListItem.ValueList where valueListItem can be null. the version I checked v11, and v13. not sure about the latest versions. wondering how it passed code review
Hi Chandar,
This thread is over 3 years old and those versions have been long-since retired.
But I took a look and you are probably right that there is a potential hole there. But it's a pretty small and obscure one and I very much doubt it would ever actually cause a problem unless you intentionally went out of your way to cause an exception.
The method takes in a ValueListItemUIElement. That's a UIElement, so it would not even get created unless someone was trying to display the ValueList on the screen. Which means there has to be a ValueListItem and a ValueList associated with it. otherwise, the ValueListItemUIElement wouldn't exist and the ResolveValueListItemAppearance wouldn't get called. So you'd really have to do out of your way to make that happen and there's would likely be other exceptions that occurred before you even got to that point.