B2026-019 Attempt to prevent an Access Error by utilizing a different Refresh if a Procedure is Open

This commit is contained in:
2026-02-27 10:06:24 -05:00
parent e4c6e4393e
commit 8089e2c898
2 changed files with 23 additions and 17 deletions

View File

@@ -637,6 +637,8 @@ namespace VEPROMS
DisplayTabItem dti = GetTabContainingProcedure(pi.ItemID); DisplayTabItem dti = GetTabContainingProcedure(pi.ItemID);
if (dti != null) if (dti != null)
{ {
_ = ItemInfo.ResetProcedure(pi.ItemID, true);
if (!dti.MyStepTabPanel.MyStepPanel.ContainsFocus) if (!dti.MyStepTabPanel.MyStepPanel.ContainsFocus)
dti.MyStepTabPanel.MyStepPanel.Focus(); dti.MyStepTabPanel.MyStepPanel.Focus();

View File

@@ -3849,7 +3849,7 @@ namespace VEPROMS.CSLA.Library
// When This occurs, it will cause a // When This occurs, it will cause a
// "ThreadException ... Collection was modified; enumeration operation may not execute.” // "ThreadException ... Collection was modified; enumeration operation may not execute.”
// ********************** // **********************
public static ProcedureInfo ResetProcedure(int procID) public static ProcedureInfo ResetProcedure(int procID, bool resetindisplaytab = false)
{ {
// The following lines reload the procedure info cache // The following lines reload the procedure info cache
ProcedureInfo newproc = ProcedureInfo.Get(procID, true); ProcedureInfo newproc = ProcedureInfo.Get(procID, true);
@@ -3867,6 +3867,8 @@ namespace VEPROMS.CSLA.Library
ItemInfo newprocitem = Get(procID, true); ItemInfo newprocitem = Get(procID, true);
newprocitem.RefreshConfig(); newprocitem.RefreshConfig();
if (!resetindisplaytab)
{
//Reload all the child/sub items //Reload all the child/sub items
#pragma warning disable S2971 // LINQ expressions should be simplified - need initial ToList to force enumeration #pragma warning disable S2971 // LINQ expressions should be simplified - need initial ToList to force enumeration
//otherwise will get a "Collection was modified; enumeration operation may not execute" error //otherwise will get a "Collection was modified; enumeration operation may not execute" error
@@ -3887,6 +3889,8 @@ namespace VEPROMS.CSLA.Library
pconfigrefresh_items[index].MyProcedure = newproc; pconfigrefresh_items[index].MyProcedure = newproc;
} }
}
//return the changed procedure info //return the changed procedure info
return newproc; return newproc;
} }