Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
260
NullReferenceExcpetion in MergeAppearanceProp
posted

Hello there,

I receive a NullReferenceException at MergeAppearanceProp in random intervalls from different sources. Details like stacktraces and code are at the endd of this post.

I have a grid bound to a UltraBindingSource which is bound to a DataTable (Columns: TimeStamp : DateTime, Type :string, Title : string,  Message : string).

In the grid designer, I changed the editor of the message column to an UltraFormattedTextEditor (I have 1 invisible instance in the designer.

The data source is filled with logs. The InitializeRow event checks if not reInitialising and if the Type column equals "ERROR", if so, the backcolour of the row is changed to red.

This works fine for a while (5 - 120 logs/rows). Then a NullReferenceException occurs in Infragistics.Win.AppStyling.AppearanceInfo.MergeAppearanceProp. The top of the Stacktrace differs.Most of the time it happens in the OnPaint event and sometimes in the InitializeRow event (usually in PerformAutoResize)

Am I doing something wrong?

It seems to me, that it is a race condition. Can I somehow avoid it?

If this is a bug, is there a workaround for the meantime? (I just delivered the first demo versions of our software)

Any help is greatly appreciated,

Dennis

 

private void ultraGrid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
if (!e.ReInitialize)
{
    Debug.WriteLine("FactoryStatus.InitializeRow " + (iGridRow++).ToString());
    if (e.Row.Cells["Type"].Value.ToString().ToUpper().Equals("ERROR"))
    {
        e.Row.Appearance.BackColor = Color.Red;
    }

    //Exception usually happens in the next line here
    e.Row.Cells["TimeStamp"].Column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand);

    e.Row.Cells["Source"].Column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand);
    e.Row.Cells["Type"].Column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand);
    e.Row.PerformAutoSize();
}
}

InitializeRow event stacktrace:

     bei Infragistics.Win.AppStyling.AppearanceInfo.MergeAppearanceProp(AppearanceData& appearance, AppearancePropFlags property, Object propertyValue)
   bei Infragistics.Win.AppStyling.AppearanceInfo.MergeData(AppearanceData& appearance, AppearancePropFlags& requestedProps)
   bei Infragistics.Win.AppStyling.UIRole.ResolveAppearance(AppearanceData& appearance, AppearancePropFlags& requestedProps, RoleState state)
   bei Infragistics.Win.UltraWinGrid.UltraGridBand.MergeBLOverrideAppearances(AppearanceData& appData, ResolveAppearanceContext& context, OverrideAppearanceIndex index, UIRole role, RoleState roleState)
   bei Infragistics.Win.UltraWinGrid.UltraGridBand.MergeBLOverrideAppearances(AppearanceData& appData, ResolveAppearanceContext& context, OverrideAppearanceIndex index, RoleState roleState)
   bei Infragistics.Win.UltraWinGrid.UltraGridRow.ResolveCellAppearance(UltraGridColumn column, AppearanceData& appData, AppearancePropFlags& requestedProps, Boolean cellAppearanceOnly, Boolean forceSelected, ForceActive forceActive, Boolean isMergedCell, Boolean hotTrackingCell, Boolean hotTrackingRow, Boolean isProxyResolution)
   bei Infragistics.Win.UltraWinGrid.UltraGridLayout.ResolvedCachedCellAppearance(UltraGridRow row, UltraGridColumn column, AppearanceData& appData, AppearancePropFlags& flags, Boolean hotTrackingCell, Boolean hotTrackingRow)
   bei Infragistics.Win.UltraWinGrid.GridEmbeddableEditorOwnerInfoBase.ResolveAppearance(Object ownerContext, AppearanceData& appearance, AppearancePropFlags& requestedProps, EmbeddableEditorArea area, Boolean hotTracking, String customArea, Boolean isProxyResolution)
   bei Infragistics.Win.UltraWinGrid.GridEmbeddableEditorOwnerInfoBase.ResolveAppearance(Object ownerContext, AppearanceData& appearance, AppearancePropFlags& requestedProps, EmbeddableEditorArea area, Boolean hotTracking, String customArea)
   bei Infragistics.Win.EditorWithMask.ResolveAppearance(AppearanceData& appData, AppearancePropFlags& requestedProps, EmbeddableEditorOwnerBase owner, Object ownerContext)
   bei Infragistics.Win.EditorWithMask.GetSize(EditorSizeInfo& sizeInfo)
   bei Infragistics.Win.DateTimeEditor.GetSize(EditorSizeInfo& sizeInfo)
   bei Infragistics.Win.EmbeddableEditorBase.GetSize(EmbeddableEditorOwnerBase owner, Object ownerContext, Boolean valueOnly, Boolean full, Boolean borders, Int32 maxTextWidth, Int32 height)
   bei Infragistics.Win.UltraWinGrid.UltraGridColumn.CalculateCellTextWidth(UltraGridRow row, Graphics gr, StringFormat stringFormat, Int32 maxColWidth)
   bei Infragistics.Win.UltraWinGrid.UltraGridColumn.TraverseRowsCallback.Infragistics.Win.UltraWinGrid.IRowCallback.ProcessRow(UltraGridRow row)
   bei Infragistics.Win.UltraWinGrid.RowsCollection.InternalTraverseRowsHelper(UltraGridBand band, IRowCallback rowCallback, IRowsCollectionCallback rowsCollectionCallback, Boolean recursive, Boolean includeTemplateAddRows)
   bei Infragistics.Win.UltraWinGrid.UltraGridColumn.CalculateMaxCellTextWidth(Int32 maxColWidth, RowsCollection rows, Int32 nRows, Int32 maxRowsCollections)
   bei Infragistics.Win.UltraWinGrid.UltraGridColumn.PerformAutoResizeHelper(RowsCollection rows, Int32 nRows, Boolean applyWidth, Boolean includeHeader, Boolean includeCells, Int32 maxRowsCollections)
   bei Infragistics.Win.UltraWinGrid.UltraGridColumn.PerformAutoResize(PerformAutoSizeType autoSizeType, Boolean includeHeader)
   bei Infragistics.Win.UltraWinGrid.UltraGridColumn.PerformAutoResize(PerformAutoSizeType autoSizeType)
   bei De.HfInstruments.HardwarePanels.Controls.FactoryStatus.ultraGrid_InitializeRow(Object sender, InitializeRowEventArgs e) in F:\HardwarePanels\Controls\FactoryStatus.cs:Zeile 178.
   bei Infragistics.Win.UltraWinGrid.UltraGrid.OnInitializeRow(InitializeRowEventArgs e)
   bei Infragistics.Win.UltraWinGrid.UltraGrid.FireEvent(GridEventIds id, EventArgs e)
   bei Infragistics.Win.UltraWinGrid.UltraGrid.FireInitializeRow(InitializeRowEventArgs e)
   bei Infragistics.Win.UltraWinGrid.UltraGridRow.FireInitializeRow()
   bei Infragistics.Win.UltraWinGrid.RowsCollection.OnListChangedHelper(ListChangedEventArgs e, Boolean calledFromBandListChanged)
   bei Infragistics.Win.UltraWinGrid.RowsCollection.OnListChanged(Object sender, ListChangedEventArgs e)

 

OnPaint stacktrace:

   bei Infragistics.Win.AppStyling.AppearanceInfo.MergeAppearanceProp(AppearanceData& appearance, AppearancePropFlags property, Object propertyValue)
   bei Infragistics.Win.AppStyling.AppearanceInfo.MergeData(AppearanceData& appearance, AppearancePropFlags& requestedProps)
   bei Infragistics.Win.AppStyling.UIRole.ResolveAppearance(AppearanceData& appearance, AppearancePropFlags& requestedProps, RoleState state)
   bei Infragistics.Win.UltraWinGrid.UltraGridBand.MergeBLOverrideAppearances(AppearanceData& appData, ResolveAppearanceContext& context, OverrideAppearanceIndex index, UIRole role, RoleState roleState)
   bei Infragistics.Win.UltraWinGrid.UltraGridBand.MergeBLOverrideAppearances(AppearanceData& appData, ResolveAppearanceContext& context, OverrideAppearanceIndex index, RoleState roleState)
   bei Infragistics.Win.UltraWinGrid.UltraGridRow.ResolveCellAppearance(UltraGridColumn column, AppearanceData& appData, AppearancePropFlags& requestedProps, Boolean cellAppearanceOnly, Boolean forceSelected, ForceActive forceActive, Boolean isMergedCell, Boolean hotTrackingCell, Boolean hotTrackingRow, Boolean isProxyResolution)
   bei Infragistics.Win.UltraWinGrid.UltraGridLayout.ResolvedCachedCellAppearance(UltraGridRow row, UltraGridColumn column, AppearanceData& appData, AppearancePropFlags& flags, Boolean hotTrackingCell, Boolean hotTrackingRow)
   bei Infragistics.Win.UltraWinGrid.CellUIElementBase.InternalInitAppearance(AppearanceData& appearance, AppearancePropFlags& requestedProps)
   bei Infragistics.Win.UltraWinGrid.CellUIElementBase.InitAppearance(AppearanceData& appearance, AppearancePropFlags& requestedProps)
   bei Infragistics.Win.UIElement.InitializeDrawAppearance(AppearanceData& defaultAppearance, AppearanceData& appearance)
   bei Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   bei Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   bei Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   bei Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   bei Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   bei Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   bei Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   bei Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   bei Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   bei Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   bei Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   bei Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
   bei Infragistics.Win.UIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
   bei Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics)
   bei Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize)
   bei Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   bei Infragistics.Win.UltraWinGrid.UltraGridUIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   bei Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)
   bei Infragistics.Win.UltraWinGrid.UltraGrid.OnPaint(PaintEventArgs pe)
   bei System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   bei System.Windows.Forms.Control.WmPaint(Message& m)
   bei System.Windows.Forms.Control.WndProc(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

Parents Reply Children
No Data