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.
Chandar,
It sounds as though the exception is intermittent for your users. One common cause of such issues in Windows Forms applications is improper use of threading in the application where UI Controls get updated on a background thread. If you are using threading, I recommend reviewing your application to make sure all updates are happening on the UI thread.
As far as us looking into the exception, we would need a sample that would reproduce the issue to understand how something we didn't expect to be null could be null. Since you haven't yet reproduced the issue, I recommend gathering more details on what scenarios specifically cause the exception from your users.
Occasionally users reporting this exception, may be as you said, going out in a wrong way as the customer is interacting with the control/application. However I am unable to reproduce it at my side. perhaps it is related to timing issue or some other. when this happens my code is not involved in the stack trace. so, I am looking into the code to identify the possible root cause.
Changing to new version is not an option for now due to business reasons.
Again thanks for the quick response.