Following the source code and the stack trace, I can se that OnLayout is calling to calculatePaddingForAlignment and CalculateTopAndBottomPadding.
CalculateTopAndBottomPadding, implemented in CellElement is creating an instance of Paint object using the paintText property. It seems that NullPointerException is produced because paintText is sometimes null.
The unique point in the code where paintText could be null is calling to the Dispose method because it is always initialized:
protected override void Dispose(bool disposing)
{
if (disposing)
{
this.paintText = null;
this.paintBorder = null;
this.GridColumn = null;
this.GetDataColumn = null;
this.gridModel = null;
}
base.Dispose(disposing);
}
Perhaps, for some reason, sometimes OnLayout is called after Dispose and it generates a NullPointerException in GridHeaderCellControl.
I cannot be sure because I cannot debug but the exception could be produced in CellElement.CalculateTopAndBottomPadding executing the code:
Paint paint = new Paint(paintText); <---- HERE BECAUSE paintText is NULL
paint.SetTypeface(view.get_Typeface());
paint.set_Flags(65);
paint.set_TextSize(view.get_TextSize());
Regards!
I have updated the info in the direct-track. Please, review asap because we are in a very complex situation with our project... Thanks.