The NullReference exception occurs in some circumstances in the code of the How to set focus to a ParametrizedAction (Full Text Search) in code ticket:
> DXApplication2.Module.Win.dll!DXApplication2.Module.Win.Controllers.Controller1.FocusFullTextSearch(DevExpress.XtraBars.BarItem barItem) Line 90 C#
DXApplication2.Module.Win.dll!DXApplication2.Module.Win.Controllers.Controller1.View_DocumentActivated(object sender, DevExpress.XtraBars.Docking2010.Views.DocumentEventArgs e) Line 76 C#
DevExpress.XtraBars.v18.1.dll!DevExpress.XtraBars.Docking2010.Views.BaseView.RaiseDocumentActivated(DevExpress.XtraBars.Docking2010.Views.BaseDocument document) Unknown
DevExpress.XtraBars.v18.1.dll!DevExpress.XtraBars.Docking2010.Views.BaseView.OnDocumentActivated(DevExpress.XtraBars.Docking2010.Views.BaseDocument document) Unknown
DevExpress.XtraBars.v18.1.dll!DevExpress.XtraBars.Docking2010.Views.BaseView.SetActiveDocumentCore(DevExpress.XtraBars.Docking2010.Views.BaseDocument document) Unknown
DevExpress.XtraBars.v18.1.dll!DevExpress.XtraBars.Docking2010.Views.BaseView.ActivateDocument(System.Windows.Forms.Control control) Unknown
DevExpress.XtraBars.v18.1.dll!DevExpress.XtraBars.Docking2010.MDIClientManagementStrategy.OnMdiChildActivate(object sender, System.EventArgs e) Unknown
…
'Application.MainWindow' is null:
C#private void FocusFullTextSearch(BarItem barItem)
{
((Form)Application.MainWindow.Template).BeginInvoke(new MethodInvoker(() => {
BarItemLinkReadOnlyCollection visibleLinks = barItem.GetVisibleLinks();
if (visibleLinks.Count > 0)
{
visibleLinks[0].Focus();
}
}));
}