When setting control visibility I sometimes get this:
CRASH! Failed to refresh job control:
Exception:NullReferenceException
Message:Object reference not set to an instance of an object.
Source: System.Windows.Forms
TargetSite: SetVisibleCore
StackTrace: at System.Windows.Forms.ToolStripControlHost.SetVisibleCore(Boolean visible)
at System.Windows.Forms.ToolStripItem.set_Visible(Boolean value)
at Cwc.WaterWorks.Console.frmMain.SetToolStripOptionalButtons()
at Cwc.WaterWorks.Console.frmMain.UpdateToolStrip(ToolStripButton toolStripButton)
at Cwc.WaterWorks.Console.frmMain.RefreshJobControl(Boolean fetch)
Called from:
private void SetToolStripOptionalButtons()
{
NewJobButtonsVisibility(newJobStripButton.Checked);
JobListButtonsVisibility(jobListStripButton.Checked);
jumpToJob.Visible = !newJobStripButton.Checked;
if (newJobStripButton.Checked)
{
JobCreateStatus(false);
uxLockedToolStrip.Visible = false;
HideJobControlButtons();
}
else if (jobListStripButton.Checked)
{
UpdateFilterStatus();
HideJobControlButtons();
}
else if (controlStripButton.Checked)
{
ShowJobControlButtons();
}
findCustomerStripButton.Enabled = newJobStripButton.Checked && basis2ServiceLayer.Basis2Status.IsConnected==true;
filterStripDropDown.Enabled = jobListStripButton.Checked;
}
Any ideas why?