When you launch a function, if the function contains Form. Close () for the current Form, an error may be reported at Application. Run.
For this reason, I found the problem during disassembly tracking. The original function is as follows:
Code Private void navbarcontrolincludoubleclick (object sender, EventArgs e)
{
If (navBarControl1.PressedLink! = Null)
{
String itemname = navBarControl1.PressedLink. ItemName;
This. _ dynamicHelper. Methods. Invoke (itemname + "_ DoubleClicked", DynamicHelperBase. InstanceBindingFlags );
}
}
This function calls the corresponding function of the current form based on its ItemName for a series of navigation.
However, an error is thrown when you exit the navigation. The reason is that this. _ dynamicHelper. methods. after Invoke, The navbarcontrolpolicdoubleclick function will be returned, but the current form has been released before. At this time, the function is an invalid reference. Change to the following to solve the problem:
Code Private void navbarcontrolincludoubleclick (object sender, EventArgs e)
{
If (navBarControl1.PressedLink! = Null)
{
String iname = navBarControl1.PressedLink. ItemName;
This. BeginInvoke (new Action <string> (itemname) =>
{
This. _ dynamicHelper. Methods. Invoke (itemname + "_ DoubleClicked", DynamicHelperBase. InstanceBindingFlags );
}), Iname );
}
}