File tree 3 files changed +21
-15
lines changed
3 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -880,7 +880,7 @@ private void OnPreviewGraphCompleted(AsyncTask asyncTask)
880
880
/// trace data but do not exist in the current CallSite data.
881
881
/// </summary>
882
882
/// <returns></returns>
883
- internal IList < string > GetOrphanedSerializablesAndClearHistoricalTraceData ( )
883
+ internal List < string > GetOrphanedSerializablesAndClearHistoricalTraceData ( )
884
884
{
885
885
var orphans = new List < string > ( ) ;
886
886
@@ -891,11 +891,12 @@ internal IList<string> GetOrphanedSerializablesAndClearHistoricalTraceData()
891
891
// then add the serializables for that guid to the list of
892
892
// orphans.
893
893
894
+ var nodeLookup = Nodes . Select ( n => n . GUID ) . ToHashSet ( ) ;
894
895
foreach ( var nodeData in historicalTraceData )
895
896
{
896
897
var nodeGuid = nodeData . Key ;
897
898
898
- if ( Nodes . All ( n => n . GUID != nodeGuid ) )
899
+ if ( ! nodeLookup . Contains ( nodeGuid ) )
899
900
{
900
901
orphans . AddRange ( nodeData . Value . SelectMany ( CallSite . GetAllSerializablesFromSingleRunTraceData ) ) ;
901
902
}
Original file line number Diff line number Diff line change @@ -1265,17 +1265,22 @@ private void EngineController_TraceReconcliationComplete(TraceReconciliationEven
1265
1265
foreach ( var maybeWs in Workspaces )
1266
1266
{
1267
1267
foreach ( var node in maybeWs . Nodes )
1268
+ {
1268
1269
nodeToWorkspaceMap [ node . GUID ] = maybeWs ;
1270
+ }
1269
1271
1270
- var ws = maybeWs as HomeWorkspaceModel ;
1271
- if ( ws == null )
1272
+ if ( maybeWs is not HomeWorkspaceModel ws )
1273
+ {
1272
1274
continue ;
1275
+ }
1273
1276
1274
1277
// Get the orphaned serializables to this workspace
1275
- var wsOrphans = ( List < string > ) ws . GetOrphanedSerializablesAndClearHistoricalTraceData ( ) ;
1278
+ var wsOrphans = ws . GetOrphanedSerializablesAndClearHistoricalTraceData ( ) ;
1276
1279
1277
1280
if ( ! wsOrphans . Any ( ) )
1281
+ {
1278
1282
continue ;
1283
+ }
1279
1284
1280
1285
if ( workspaceOrphanMap . TryGetValue ( ws . Guid , out var workspaceOrphans ) )
1281
1286
{
@@ -1296,15 +1301,9 @@ private void EngineController_TraceReconcliationComplete(TraceReconciliationEven
1296
1301
// TODO: MAGN-7314
1297
1302
// Find the owning workspace for a node.
1298
1303
if ( ! nodeToWorkspaceMap . TryGetValue ( nodeGuid , out var nodeSpace ) )
1304
+ {
1299
1305
continue ;
1300
-
1301
- //var nodeSpace =
1302
- // Workspaces.FirstOrDefault(
1303
- // ws =>
1304
- // ws.Nodes.FirstOrDefault(n => n.GUID == nodeGuid)
1305
- // != null);
1306
-
1307
- //if (nodeSpace == null) continue;
1306
+ }
1308
1307
1309
1308
// Add the node's orphaned serializables to the workspace
1310
1309
// orphan map.
Original file line number Diff line number Diff line change @@ -159,15 +159,19 @@ public List<string> RecursiveGetNestedData()
159
159
return ret ;
160
160
}
161
161
162
- public void RecursiveFillWithNestedData ( List < string > listToFill )
162
+ internal void RecursiveFillWithNestedData ( List < string > listToFill )
163
163
{
164
164
if ( HasData )
165
+ {
165
166
listToFill . Add ( Data ) ;
167
+ }
166
168
167
169
if ( HasNestedData )
168
170
{
169
171
foreach ( SingleRunTraceData srtd in NestedData )
172
+ {
170
173
srtd . RecursiveFillWithNestedData ( listToFill ) ;
174
+ }
171
175
}
172
176
}
173
177
}
@@ -475,8 +479,10 @@ private static string CompressSerializedTraceData(string json)
475
479
/// </summary>
476
480
public IList < string > GetOrphanedSerializables ( )
477
481
{
478
- if ( beforeFirstRunSerializables . Count == 0 )
482
+ if ( ! beforeFirstRunSerializables . Any ( ) )
483
+ {
479
484
return new List < string > ( ) ;
485
+ }
480
486
481
487
var currentSerializables = traceData . SelectMany ( td => td . RecursiveGetNestedData ( ) ) . ToHashSet ( ) ;
482
488
var result = beforeFirstRunSerializables . Where ( hs => ! currentSerializables . Contains ( hs ) ) . ToList ( ) ;
You can’t perform that action at this time.
0 commit comments