This commit is contained in:
xuejiaming 2022-05-17 17:30:07 +08:00
parent 83bbe85652
commit c1fc5cd404
2 changed files with 6 additions and 2 deletions

View File

@ -118,7 +118,9 @@ namespace Sample.AutoCreateIfPresent
if (needRefresh) if (needRefresh)
{ {
var virtualTable = _virtualTableManager.GetVirtualTable(typeof(AreaDevice)); var virtualTable = _virtualTableManager.GetVirtualTable(typeof(AreaDevice));
foreach (var tail in _tails.Keys) //修复可能导致迭代器遍历时添加的bug
var keys = _tails.Keys.ToList();
foreach (var tail in keys)
{ {
var hashSet = allPhysicTables.Select(o => o.Tail).ToHashSet(); var hashSet = allPhysicTables.Select(o => o.Tail).ToHashSet();
if (!hashSet.Contains(tail)) if (!hashSet.Contains(tail))

View File

@ -148,7 +148,9 @@ namespace Sample.AutoCreateIfPresent
if (needRefresh) if (needRefresh)
{ {
var virtualTable = _virtualTableManager.GetVirtualTable(typeof(OrderByHour)); var virtualTable = _virtualTableManager.GetVirtualTable(typeof(OrderByHour));
foreach (var tail in _tails.Keys) //修复可能导致迭代器遍历时添加的bug
var keys = _tails.Keys.ToList();
foreach (var tail in keys)
{ {
var hashSet = allPhysicTables.Select(o=>o.Tail).ToHashSet(); var hashSet = allPhysicTables.Select(o=>o.Tail).ToHashSet();
if (!hashSet.Contains(tail)) if (!hashSet.Contains(tail))