File tree Expand file tree Collapse file tree 3 files changed +21
-15
lines changed Expand file tree Collapse file tree 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)
880880 /// trace data but do not exist in the current CallSite data.
881881 /// </summary>
882882 /// <returns></returns>
883- internal IList < string > GetOrphanedSerializablesAndClearHistoricalTraceData ( )
883+ internal List < string > GetOrphanedSerializablesAndClearHistoricalTraceData ( )
884884 {
885885 var orphans = new List < string > ( ) ;
886886
@@ -891,11 +891,12 @@ internal IList<string> GetOrphanedSerializablesAndClearHistoricalTraceData()
891891 // then add the serializables for that guid to the list of
892892 // orphans.
893893
894+ var nodeLookup = Nodes . Select ( n => n . GUID ) . ToHashSet ( ) ;
894895 foreach ( var nodeData in historicalTraceData )
895896 {
896897 var nodeGuid = nodeData . Key ;
897898
898- if ( Nodes . All ( n => n . GUID != nodeGuid ) )
899+ if ( ! nodeLookup . Contains ( nodeGuid ) )
899900 {
900901 orphans . AddRange ( nodeData . Value . SelectMany ( CallSite . GetAllSerializablesFromSingleRunTraceData ) ) ;
901902 }
Original file line number Diff line number Diff line change @@ -1265,17 +1265,22 @@ private void EngineController_TraceReconcliationComplete(TraceReconciliationEven
12651265 foreach ( var maybeWs in Workspaces )
12661266 {
12671267 foreach ( var node in maybeWs . Nodes )
1268+ {
12681269 nodeToWorkspaceMap [ node . GUID ] = maybeWs ;
1270+ }
12691271
1270- var ws = maybeWs as HomeWorkspaceModel ;
1271- if ( ws == null )
1272+ if ( maybeWs is not HomeWorkspaceModel ws )
1273+ {
12721274 continue ;
1275+ }
12731276
12741277 // Get the orphaned serializables to this workspace
1275- var wsOrphans = ( List < string > ) ws . GetOrphanedSerializablesAndClearHistoricalTraceData ( ) ;
1278+ var wsOrphans = ws . GetOrphanedSerializablesAndClearHistoricalTraceData ( ) ;
12761279
12771280 if ( ! wsOrphans . Any ( ) )
1281+ {
12781282 continue ;
1283+ }
12791284
12801285 if ( workspaceOrphanMap . TryGetValue ( ws . Guid , out var workspaceOrphans ) )
12811286 {
@@ -1296,15 +1301,9 @@ private void EngineController_TraceReconcliationComplete(TraceReconciliationEven
12961301 // TODO: MAGN-7314
12971302 // Find the owning workspace for a node.
12981303 if ( ! nodeToWorkspaceMap . TryGetValue ( nodeGuid , out var nodeSpace ) )
1304+ {
12991305 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+ }
13081307
13091308 // Add the node's orphaned serializables to the workspace
13101309 // orphan map.
Original file line number Diff line number Diff line change @@ -159,15 +159,19 @@ public List<string> RecursiveGetNestedData()
159159 return ret ;
160160 }
161161
162- public void RecursiveFillWithNestedData ( List < string > listToFill )
162+ internal void RecursiveFillWithNestedData ( List < string > listToFill )
163163 {
164164 if ( HasData )
165+ {
165166 listToFill . Add ( Data ) ;
167+ }
166168
167169 if ( HasNestedData )
168170 {
169171 foreach ( SingleRunTraceData srtd in NestedData )
172+ {
170173 srtd . RecursiveFillWithNestedData ( listToFill ) ;
174+ }
171175 }
172176 }
173177 }
@@ -475,8 +479,10 @@ private static string CompressSerializedTraceData(string json)
475479 /// </summary>
476480 public IList < string > GetOrphanedSerializables ( )
477481 {
478- if ( beforeFirstRunSerializables . Count == 0 )
482+ if ( ! beforeFirstRunSerializables . Any ( ) )
483+ {
479484 return new List < string > ( ) ;
485+ }
480486
481487 var currentSerializables = traceData . SelectMany ( td => td . RecursiveGetNestedData ( ) ) . ToHashSet ( ) ;
482488 var result = beforeFirstRunSerializables . Where ( hs => ! currentSerializables . Contains ( hs ) ) . ToList ( ) ;
You can’t perform that action at this time.
0 commit comments