private void OnTraceReconciliationComplete(TraceReconciliationEventArgs e) { if (TraceReconcliationComplete != null) { TraceReconcliationComplete(e); } }
private void EngineController_TraceReconcliationComplete(TraceReconciliationEventArgs obj) { Debug.WriteLine("TRACE RECONCILIATION: {0} total serializables were orphaned.", obj.CallsiteToOrphanMap.SelectMany(kvp=>kvp.Value).Count()); // The orphans will come back here as a dictionary of lists of ISerializables jeyed by their callsite id. // This dictionary gets redistributed into a dictionary keyed by the workspace id. var workspaceOrphanMap = new Dictionary<Guid, List<ISerializable>>(); foreach (var ws in Workspaces.OfType<HomeWorkspaceModel>()) { // Get the orphaned serializables to this workspace var wsOrphans = ws.GetOrphanedSerializablesAndClearHistoricalTraceData().ToList(); if (!wsOrphans.Any()) continue; if (!workspaceOrphanMap.ContainsKey(ws.Guid)) { workspaceOrphanMap.Add(ws.Guid, wsOrphans); } else { workspaceOrphanMap[ws.Guid].AddRange(wsOrphans); } } foreach (var kvp in obj.CallsiteToOrphanMap) { if (!kvp.Value.Any()) continue; var nodeGuid = EngineController.LiveRunnerRuntimeCore.RuntimeData.CallSiteToNodeMap[kvp.Key]; // TODO: MAGN-7314 // Find the owning workspace for a node. var nodeSpace = Workspaces.FirstOrDefault( ws => ws.Nodes.FirstOrDefault(n => n.GUID == nodeGuid) != null); if (nodeSpace == null) continue; // Add the node's orphaned serializables to the workspace // orphan map. if (workspaceOrphanMap.ContainsKey(nodeSpace.Guid)) { workspaceOrphanMap[nodeSpace.Guid].AddRange(kvp.Value); } else { workspaceOrphanMap.Add(nodeSpace.Guid, kvp.Value); } } TraceReconciliationProcessor.PostTraceReconciliation(workspaceOrphanMap); }