From 64b47063f8ca8750dbcbadc6b0a1696214862288 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 23 Aug 2023 15:53:48 -0400 Subject: [PATCH 01/18] remove coreclr-ncalc references --- src/Libraries/CoreNodeModels/CoreNodeModels.csproj | 3 --- src/Libraries/CoreNodes/CoreNodes.csproj | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/Libraries/CoreNodeModels/CoreNodeModels.csproj b/src/Libraries/CoreNodeModels/CoreNodeModels.csproj index 65517fc2627..d8ec29f9e71 100644 --- a/src/Libraries/CoreNodeModels/CoreNodeModels.csproj +++ b/src/Libraries/CoreNodeModels/CoreNodeModels.csproj @@ -28,9 +28,6 @@ - - - diff --git a/src/Libraries/CoreNodes/CoreNodes.csproj b/src/Libraries/CoreNodes/CoreNodes.csproj index 99ed8ac50bd..405dd745469 100644 --- a/src/Libraries/CoreNodes/CoreNodes.csproj +++ b/src/Libraries/CoreNodes/CoreNodes.csproj @@ -22,9 +22,6 @@ - - - From 37d470c139716beb92e626974008bd56a7cc7133 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 20 Nov 2023 13:22:05 -0500 Subject: [PATCH 02/18] show legacy trace warning --- .../Graph/Workspaces/SerializationConverters.cs | 13 +++++++++++-- src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs | 2 ++ src/DynamoCore/Models/DynamoModel.cs | 4 ++++ src/DynamoCore/Models/DynamoModelEvents.cs | 6 +++--- src/DynamoCore/Properties/Resources.Designer.cs | 9 +++++++++ src/DynamoCore/Properties/Resources.en-US.resx | 3 +++ src/DynamoCore/Properties/Resources.resx | 3 +++ .../ViewModels/Core/DynamoViewModel.cs | 4 ++-- 8 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs index 9529b9a147f..df4712d66ef 100644 --- a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs +++ b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs @@ -679,9 +679,15 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist #region Restore trace data // Trace Data Dictionary> loadedTraceData = new Dictionary>(); + bool legacyTraceDataWarning = false; // Restore trace data if bindings are present in json if (obj["Bindings"] != null && obj["Bindings"].Children().Count() > 0) { + if (AssemblyHelper.GetDynamoVersion(false) < new Version(3, 1, 0)) + { + legacyTraceDataWarning = true; + } + JEnumerable bindings = obj["Bindings"].Children(); // Iterate through bindings to extract nodeID's and bindingData (callsiteId & traceData) @@ -725,7 +731,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist if (obj.TryGetValue(nameof(HomeWorkspaceModel.Thumbnail), StringComparison.OrdinalIgnoreCase, out JToken thumbnail)) homeWorkspace.Thumbnail = thumbnail.ToString(); - // GraphDocumentaionLink + // GraphDocumentationLink if (obj.TryGetValue(nameof(HomeWorkspaceModel.GraphDocumentationURL), StringComparison.OrdinalIgnoreCase, out JToken helpLink)) { if (Uri.TryCreate(helpLink.ToString(), UriKind.Absolute, out Uri uri)) @@ -738,6 +744,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist // If there is a active linter serialized in the graph we set it to the active linter else set the default None. SetActiveLinter(obj); + ws = homeWorkspace; } @@ -746,7 +753,9 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist ws.ExternalFiles = externalFiles; if (obj.TryGetValue(nameof(WorkspaceModel.Author), StringComparison.OrdinalIgnoreCase, out JToken author)) ws.Author = author.ToString(); - + + ws.LegacyTraceDataWarning = legacyTraceDataWarning; + return ws; } diff --git a/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs b/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs index bb04951472d..da772dff9cd 100644 --- a/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs +++ b/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs @@ -233,6 +233,8 @@ internal int CurrentPasteOffset } } + internal bool LegacyTraceDataWarning { get; set; } + internal bool ScaleFactorChanged = false; /// diff --git a/src/DynamoCore/Models/DynamoModel.cs b/src/DynamoCore/Models/DynamoModel.cs index 6ea648a5b26..82cd624264d 100644 --- a/src/DynamoCore/Models/DynamoModel.cs +++ b/src/DynamoCore/Models/DynamoModel.cs @@ -2319,6 +2319,10 @@ private bool OpenJsonFile( workspace.FileName = string.IsNullOrEmpty(filePath) ? "" : filePath; workspace.FromJsonGraphId = string.IsNullOrEmpty(filePath) ? WorkspaceModel.ComputeGraphIdFromJson(fileContents) : ""; workspace.ScaleFactor = dynamoPreferences.ScaleFactor; + if (workspace.LegacyTraceDataWarning) + { + OnRequestNotification(Resources.LegacyTraceDataWarning, true); + } // NOTE: This is to handle the case of opening a JSON file that does not have a version string // This logic may not be correct, need to decide the importance of versioning early JSON files diff --git a/src/DynamoCore/Models/DynamoModelEvents.cs b/src/DynamoCore/Models/DynamoModelEvents.cs index 7a76d0379c7..837dd1f321f 100644 --- a/src/DynamoCore/Models/DynamoModelEvents.cs +++ b/src/DynamoCore/Models/DynamoModelEvents.cs @@ -541,12 +541,12 @@ internal void OnRequestPythonReset(string pythonEngine) /// /// This event is used to raise a toast notification from the DynamoViewModel /// - internal event Action RequestNotification; - internal void OnRequestNotification(string notification) + internal event Action RequestNotification; + internal void OnRequestNotification(string notification, bool stayOpen = false) { if (RequestNotification != null) { - RequestNotification(notification); + RequestNotification(notification, stayOpen); } } diff --git a/src/DynamoCore/Properties/Resources.Designer.cs b/src/DynamoCore/Properties/Resources.Designer.cs index f523c41ad4c..1e88e4b92c3 100644 --- a/src/DynamoCore/Properties/Resources.Designer.cs +++ b/src/DynamoCore/Properties/Resources.Designer.cs @@ -1117,6 +1117,15 @@ public static string InvalidStartOrEndOfRange { } } + /// + /// Looks up a localized string similar to This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this legacy data. Any new trace data generated during graph execution will however work if saved with the workspace.. + /// + public static string LegacyTraceDataWarning { + get { + return ResourceManager.GetString("LegacyTraceDataWarning", resourceCulture); + } + } + /// /// Looks up a localized string similar to Build error for library: {0}. /// diff --git a/src/DynamoCore/Properties/Resources.en-US.resx b/src/DynamoCore/Properties/Resources.en-US.resx index b40c51c4764..da519fd52b0 100644 --- a/src/DynamoCore/Properties/Resources.en-US.resx +++ b/src/DynamoCore/Properties/Resources.en-US.resx @@ -908,4 +908,7 @@ This package likely contains an assembly that is blocked. You will need to load Formula node has been deprecated. It has been automatically migrated to a CodeBlock node. Note that results may vary after the migration depending on lacing options selected on the original Formula node. Appropriate replication guides might need to be applied to the CodeBlock node script. + + This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this legacy data. Any new trace data generated during graph execution will however work if saved with the workspace. + \ No newline at end of file diff --git a/src/DynamoCore/Properties/Resources.resx b/src/DynamoCore/Properties/Resources.resx index 77d3d8340dd..7089ffc0bed 100644 --- a/src/DynamoCore/Properties/Resources.resx +++ b/src/DynamoCore/Properties/Resources.resx @@ -911,4 +911,7 @@ This package likely contains an assembly that is blocked. You will need to load Formula node has been deprecated. It has been automatically migrated to a CodeBlock node. Note that results may vary after the migration depending on lacing options selected on the original Formula node. Appropriate replication guides might need to be applied to the CodeBlock node script. + + This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this legacy data. Any new trace data generated during graph execution will however work if saved with the workspace. + \ No newline at end of file diff --git a/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs b/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs index 5985e801a57..dd08cc1e477 100644 --- a/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs @@ -1907,9 +1907,9 @@ private void model_ComputeModelDeserialized() /// Create a toast notification with a notification sent by the DynamoModel /// /// - private void model_RequestNotification(string notification) + private void model_RequestNotification(string notification, bool stayOpen = false) { - this.MainGuideManager.CreateRealTimeInfoWindow(notification); + this.MainGuideManager.CreateRealTimeInfoWindow(notification, stayOpen); } /// From 9c09ab3d919d3b77fa4678bd1d49538275e405c9 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 20 Nov 2023 13:27:18 -0500 Subject: [PATCH 03/18] cleanup --- src/DynamoCore/Graph/Workspaces/SerializationConverters.cs | 2 +- src/DynamoCore/Properties/Resources.Designer.cs | 2 +- src/DynamoCore/Properties/Resources.en-US.resx | 2 +- src/DynamoCore/Properties/Resources.resx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs index df4712d66ef..87591bc800a 100644 --- a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs +++ b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs @@ -683,7 +683,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist // Restore trace data if bindings are present in json if (obj["Bindings"] != null && obj["Bindings"].Children().Count() > 0) { - if (AssemblyHelper.GetDynamoVersion(false) < new Version(3, 1, 0)) + if (AssemblyHelper.GetDynamoVersion(false) < new Version(3, 0, 0)) { legacyTraceDataWarning = true; } diff --git a/src/DynamoCore/Properties/Resources.Designer.cs b/src/DynamoCore/Properties/Resources.Designer.cs index 1e88e4b92c3..cb72f8b327f 100644 --- a/src/DynamoCore/Properties/Resources.Designer.cs +++ b/src/DynamoCore/Properties/Resources.Designer.cs @@ -1118,7 +1118,7 @@ public static string InvalidStartOrEndOfRange { } /// - /// Looks up a localized string similar to This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this legacy data. Any new trace data generated during graph execution will however work if saved with the workspace.. + /// Looks up a localized string similar to This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this data. However, any new trace data generated during graph execution will work if saved with the workspace.. /// public static string LegacyTraceDataWarning { get { diff --git a/src/DynamoCore/Properties/Resources.en-US.resx b/src/DynamoCore/Properties/Resources.en-US.resx index da519fd52b0..d19fb5c291b 100644 --- a/src/DynamoCore/Properties/Resources.en-US.resx +++ b/src/DynamoCore/Properties/Resources.en-US.resx @@ -909,6 +909,6 @@ This package likely contains an assembly that is blocked. You will need to load Formula node has been deprecated. It has been automatically migrated to a CodeBlock node. Note that results may vary after the migration depending on lacing options selected on the original Formula node. Appropriate replication guides might need to be applied to the CodeBlock node script. - This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this legacy data. Any new trace data generated during graph execution will however work if saved with the workspace. + This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this data. However, any new trace data generated during graph execution will work if saved with the workspace. \ No newline at end of file diff --git a/src/DynamoCore/Properties/Resources.resx b/src/DynamoCore/Properties/Resources.resx index 7089ffc0bed..e1f2817bfb5 100644 --- a/src/DynamoCore/Properties/Resources.resx +++ b/src/DynamoCore/Properties/Resources.resx @@ -912,6 +912,6 @@ This package likely contains an assembly that is blocked. You will need to load Formula node has been deprecated. It has been automatically migrated to a CodeBlock node. Note that results may vary after the migration depending on lacing options selected on the original Formula node. Appropriate replication guides might need to be applied to the CodeBlock node script. - This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this legacy data. Any new trace data generated during graph execution will however work if saved with the workspace. + This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this data. However, any new trace data generated during graph execution will work if saved with the workspace. \ No newline at end of file From 946e529f70962520ea22036ae260f073ab0bf3aa Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 20 Nov 2023 14:12:00 -0500 Subject: [PATCH 04/18] get workspace version correctly --- .../Graph/Workspaces/SerializationConverters.cs | 11 ++++------- src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs | 2 +- src/DynamoCore/Models/DynamoModel.cs | 13 +++++++------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs index 87591bc800a..06d2b0a6dc3 100644 --- a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs +++ b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs @@ -679,15 +679,12 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist #region Restore trace data // Trace Data Dictionary> loadedTraceData = new Dictionary>(); - bool legacyTraceDataWarning = false; + bool containsTraceData = false; // Restore trace data if bindings are present in json if (obj["Bindings"] != null && obj["Bindings"].Children().Count() > 0) { - if (AssemblyHelper.GetDynamoVersion(false) < new Version(3, 0, 0)) - { - legacyTraceDataWarning = true; - } - + containsTraceData = true; + JEnumerable bindings = obj["Bindings"].Children(); // Iterate through bindings to extract nodeID's and bindingData (callsiteId & traceData) @@ -754,7 +751,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist if (obj.TryGetValue(nameof(WorkspaceModel.Author), StringComparison.OrdinalIgnoreCase, out JToken author)) ws.Author = author.ToString(); - ws.LegacyTraceDataWarning = legacyTraceDataWarning; + ws.ContainsTraceData = containsTraceData; return ws; } diff --git a/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs b/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs index da772dff9cd..e7ff4b05e45 100644 --- a/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs +++ b/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs @@ -233,7 +233,7 @@ internal int CurrentPasteOffset } } - internal bool LegacyTraceDataWarning { get; set; } + internal bool ContainsTraceData { get; set; } internal bool ScaleFactorChanged = false; diff --git a/src/DynamoCore/Models/DynamoModel.cs b/src/DynamoCore/Models/DynamoModel.cs index 82cd624264d..e6bc6000062 100644 --- a/src/DynamoCore/Models/DynamoModel.cs +++ b/src/DynamoCore/Models/DynamoModel.cs @@ -2319,18 +2319,19 @@ private bool OpenJsonFile( workspace.FileName = string.IsNullOrEmpty(filePath) ? "" : filePath; workspace.FromJsonGraphId = string.IsNullOrEmpty(filePath) ? WorkspaceModel.ComputeGraphIdFromJson(fileContents) : ""; workspace.ScaleFactor = dynamoPreferences.ScaleFactor; - if (workspace.LegacyTraceDataWarning) - { - OnRequestNotification(Resources.LegacyTraceDataWarning, true); - } + // NOTE: This is to handle the case of opening a JSON file that does not have a version string // This logic may not be correct, need to decide the importance of versioning early JSON files string versionString = dynamoPreferences.Version; - if (versionString == null) - versionString = AssemblyHelper.GetDynamoVersion().ToString(); + if (versionString == null) versionString = AssemblyHelper.GetDynamoVersion().ToString(); workspace.WorkspaceVersion = new System.Version(versionString); + if (workspace.ContainsTraceData && workspace.WorkspaceVersion < new Version(3, 0, 0)) + { + OnRequestNotification(Resources.LegacyTraceDataWarning, true); + } + HomeWorkspaceModel homeWorkspace = workspace as HomeWorkspaceModel; if (homeWorkspace != null) { From 5a9d8786a9f8cb35b827bb90d16b8f44142f3d50 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 20 Nov 2023 14:27:10 -0500 Subject: [PATCH 05/18] update warning --- src/DynamoCore/Properties/Resources.Designer.cs | 2 +- src/DynamoCore/Properties/Resources.en-US.resx | 2 +- src/DynamoCore/Properties/Resources.resx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DynamoCore/Properties/Resources.Designer.cs b/src/DynamoCore/Properties/Resources.Designer.cs index cb72f8b327f..969c3abc65d 100644 --- a/src/DynamoCore/Properties/Resources.Designer.cs +++ b/src/DynamoCore/Properties/Resources.Designer.cs @@ -1118,7 +1118,7 @@ public static string InvalidStartOrEndOfRange { } /// - /// Looks up a localized string similar to This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this data. However, any new trace data generated during graph execution will work if saved with the workspace.. + /// Looks up a localized string similar to This workspace contains element binding data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. Element binding will work however, if any new trace data generated during graph execution is saved with the workspace.. /// public static string LegacyTraceDataWarning { get { diff --git a/src/DynamoCore/Properties/Resources.en-US.resx b/src/DynamoCore/Properties/Resources.en-US.resx index d19fb5c291b..5dc5c2079bb 100644 --- a/src/DynamoCore/Properties/Resources.en-US.resx +++ b/src/DynamoCore/Properties/Resources.en-US.resx @@ -909,6 +909,6 @@ This package likely contains an assembly that is blocked. You will need to load Formula node has been deprecated. It has been automatically migrated to a CodeBlock node. Note that results may vary after the migration depending on lacing options selected on the original Formula node. Appropriate replication guides might need to be applied to the CodeBlock node script. - This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this data. However, any new trace data generated during graph execution will work if saved with the workspace. + This workspace contains element binding data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. Element binding will work however, if any new trace data generated during graph execution is saved with the workspace. \ No newline at end of file diff --git a/src/DynamoCore/Properties/Resources.resx b/src/DynamoCore/Properties/Resources.resx index e1f2817bfb5..088587706bd 100644 --- a/src/DynamoCore/Properties/Resources.resx +++ b/src/DynamoCore/Properties/Resources.resx @@ -912,6 +912,6 @@ This package likely contains an assembly that is blocked. You will need to load Formula node has been deprecated. It has been automatically migrated to a CodeBlock node. Note that results may vary after the migration depending on lacing options selected on the original Formula node. Appropriate replication guides might need to be applied to the CodeBlock node script. - This workspace contains trace data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. As a result element binding will fail to work with this data. However, any new trace data generated during graph execution will work if saved with the workspace. + This workspace contains element binding data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. Element binding will work however, if any new trace data generated during graph execution is saved with the workspace. \ No newline at end of file From 1dd5c3cf8b37d72044cf869b211f2d3367535e49 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 20 Nov 2023 16:35:14 -0500 Subject: [PATCH 06/18] add warning for xml DYNs --- src/DynamoCore/Graph/Nodes/NodeCategories.cs | 16 +++++++++------- src/DynamoCore/Models/DynamoModel.cs | 16 ++++++++-------- test/DynamoCoreTests/UtilityTests.cs | 6 +++--- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/DynamoCore/Graph/Nodes/NodeCategories.cs b/src/DynamoCore/Graph/Nodes/NodeCategories.cs index 54c06acdd8b..cbb4231d6e5 100644 --- a/src/DynamoCore/Graph/Nodes/NodeCategories.cs +++ b/src/DynamoCore/Graph/Nodes/NodeCategories.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -8,6 +8,7 @@ using Dynamo.Configuration; using Dynamo.Engine; using Dynamo.Graph.Nodes.CustomNodes; +using Dynamo.Graph.Workspaces; using Dynamo.Library; using ProtoCore; @@ -282,7 +283,7 @@ internal static string GetDocumentXmlPath(XmlDocument document) /// Returns a dictionary of deserialized node-data-list pairs /// loaded from the given XmlDocument. internal static IEnumerable>> - LoadTraceDataFromXmlDocument(XmlDocument document) + LoadTraceDataFromXmlDocument(XmlDocument document, out bool containsTraceData) { if (document == null) throw new ArgumentNullException("document"); @@ -301,7 +302,10 @@ where childNode.Name.Equals(sessionXmlTagName) var loadedData = new Dictionary>(); if (!query.Any()) // There's no data, return empty dictionary. + { + containsTraceData = false; return loadedData; + } XmlElement sessionElement = query.ElementAt(0); foreach (XmlElement nodeElement in sessionElement.ChildNodes) @@ -313,14 +317,12 @@ where childNode.Name.Equals(sessionXmlTagName) var callsiteId = string.Empty; if (child.HasAttribute(Configurations.CallSiteID)) { - callsiteId = child.GetAttribute(Configurations.CallSiteID); + containsTraceData = true; + return loadedData; } - var traceData = child.InnerText; - callsiteTraceData.Add(new CallSite.RawTraceData(callsiteId, traceData)); } - loadedData.Add(guid, callsiteTraceData); } - + containsTraceData = false; return loadedData; } diff --git a/src/DynamoCore/Models/DynamoModel.cs b/src/DynamoCore/Models/DynamoModel.cs index e6bc6000062..64ab12ed982 100644 --- a/src/DynamoCore/Models/DynamoModel.cs +++ b/src/DynamoCore/Models/DynamoModel.cs @@ -2321,19 +2321,15 @@ private bool OpenJsonFile( workspace.ScaleFactor = dynamoPreferences.ScaleFactor; - // NOTE: This is to handle the case of opening a JSON file that does not have a version string - // This logic may not be correct, need to decide the importance of versioning early JSON files - string versionString = dynamoPreferences.Version; - if (versionString == null) versionString = AssemblyHelper.GetDynamoVersion().ToString(); - workspace.WorkspaceVersion = new System.Version(versionString); + // This is to handle the case of opening a JSON file that does not have a version string + if (dynamoPreferences.Version == null) workspace.WorkspaceVersion = AssemblyHelper.GetDynamoVersion(); if (workspace.ContainsTraceData && workspace.WorkspaceVersion < new Version(3, 0, 0)) { OnRequestNotification(Resources.LegacyTraceDataWarning, true); } - HomeWorkspaceModel homeWorkspace = workspace as HomeWorkspaceModel; - if (homeWorkspace != null) + if (workspace is HomeWorkspaceModel homeWorkspace) { homeWorkspace.EnableLegacyPolyCurveBehavior ??= PreferenceSettings.Instance.DefaultEnableLegacyPolyCurveBehavior; @@ -2456,12 +2452,16 @@ private bool OpenXmlHomeWorkspace( { var nodeGraph = NodeGraph.LoadGraphFromXml(xmlDoc, NodeFactory); Guid deterministicId = GuidUtility.Create(GuidUtility.UrlNamespace, workspaceInfo.Name); + + var loadedTraceData = Utils.LoadTraceDataFromXmlDocument(xmlDoc, out var containsTraceData); + if(containsTraceData) OnRequestNotification(Resources.LegacyTraceDataWarning, true); + var newWorkspace = new HomeWorkspaceModel( deterministicId, EngineController, Scheduler, NodeFactory, - Utils.LoadTraceDataFromXmlDocument(xmlDoc), + loadedTraceData, nodeGraph.Nodes, nodeGraph.Notes, nodeGraph.Annotations, diff --git a/test/DynamoCoreTests/UtilityTests.cs b/test/DynamoCoreTests/UtilityTests.cs index 23a8a0c1f94..a65f43b2ddc 100644 --- a/test/DynamoCoreTests/UtilityTests.cs +++ b/test/DynamoCoreTests/UtilityTests.cs @@ -300,14 +300,14 @@ public void LoadTraceDataFromXmlDocument00() Assert.Throws(() => { // Test method call without a valid XmlDocument. - Graph.Nodes.Utilities.LoadTraceDataFromXmlDocument(null); + Graph.Nodes.Utilities.LoadTraceDataFromXmlDocument(null, out _); }); Assert.Throws(() => { // Test XmlDocument without a document element. XmlDocument document = new XmlDocument(); - Graph.Nodes.Utilities.LoadTraceDataFromXmlDocument(document); + Graph.Nodes.Utilities.LoadTraceDataFromXmlDocument(document, out _); }); } @@ -321,7 +321,7 @@ public void LoadTraceDataFromXmlDocument01() { XmlDocument document = new XmlDocument(); document.AppendChild(document.CreateElement("RootElement")); - outputs = Graph.Nodes.Utilities.LoadTraceDataFromXmlDocument(document); + outputs = Graph.Nodes.Utilities.LoadTraceDataFromXmlDocument(document, out _); }); Assert.IsNotNull(outputs); From e26d68217b6736593d5e66d8b2c8fd88b09d4791 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 20 Nov 2023 16:57:33 -0500 Subject: [PATCH 07/18] add unit test --- src/DynamoCore/Models/DynamoModel.cs | 5 +- test/DynamoCoreTests/CallsiteTests.cs | 13 + ...g_customNodes_modified_multiple_pre3.0.dyn | 478 ++++++++++++++++++ 3 files changed, 494 insertions(+), 2 deletions(-) create mode 100644 test/core/callsite/element_binding_customNodes_modified_multiple_pre3.0.dyn diff --git a/src/DynamoCore/Models/DynamoModel.cs b/src/DynamoCore/Models/DynamoModel.cs index 64ab12ed982..820f96f626b 100644 --- a/src/DynamoCore/Models/DynamoModel.cs +++ b/src/DynamoCore/Models/DynamoModel.cs @@ -2319,10 +2319,11 @@ private bool OpenJsonFile( workspace.FileName = string.IsNullOrEmpty(filePath) ? "" : filePath; workspace.FromJsonGraphId = string.IsNullOrEmpty(filePath) ? WorkspaceModel.ComputeGraphIdFromJson(fileContents) : ""; workspace.ScaleFactor = dynamoPreferences.ScaleFactor; - + // This is to handle the case of opening a JSON file that does not have a version string - if (dynamoPreferences.Version == null) workspace.WorkspaceVersion = AssemblyHelper.GetDynamoVersion(); + workspace.WorkspaceVersion = dynamoPreferences.Version == + null ? AssemblyHelper.GetDynamoVersion() : new Version(dynamoPreferences.Version); if (workspace.ContainsTraceData && workspace.WorkspaceVersion < new Version(3, 0, 0)) { diff --git a/test/DynamoCoreTests/CallsiteTests.cs b/test/DynamoCoreTests/CallsiteTests.cs index 13ac3e61b9c..5ccff89091a 100644 --- a/test/DynamoCoreTests/CallsiteTests.cs +++ b/test/DynamoCoreTests/CallsiteTests.cs @@ -334,5 +334,18 @@ public void CanDetectLegacyTraceFormat() "PFNPQVAtRU5WOkVudmVsb3BlIHhtbG5zOnhzaT0iaHR0cDovL3d3dyY2hlbWFzLm1pY3Jvc29mdC5jb20vc29hcC9lbmNvZGluZy"; Assert.True(CheckIfTraceDataIsLegacySOAPFormat(legacyTraceData)); } + + [Test] + public void CanWarnAboutLegacyTraceData() + { + var counter = 99; + CurrentDynamoModel.RequestNotification += (msg, stayOpen) => { counter++; }; + + // Dyn file contains SOAP formatted trace data. + var ws = Open(TestDirectory, callsiteDir, + "element_binding_customNodes_modified_multiple_pre3.0.dyn"); + + Assert.AreEqual(100, counter); + } } } diff --git a/test/core/callsite/element_binding_customNodes_modified_multiple_pre3.0.dyn b/test/core/callsite/element_binding_customNodes_modified_multiple_pre3.0.dyn new file mode 100644 index 00000000000..b68bf9aa877 --- /dev/null +++ b/test/core/callsite/element_binding_customNodes_modified_multiple_pre3.0.dyn @@ -0,0 +1,478 @@ +{ + "Uuid": "ce4b7a61-2ef7-46ba-965c-e5a69dc6d6a1", + "IsCustomNode": false, + "Description": null, + "Name": "element_binding_customNodes_modified_multiple", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "Dynamo.Graph.Nodes.CustomNodes.Function, DynamoCore", + "FunctionSignature": "9c65f412-0637-4601-ba90-9de2f539224f", + "FunctionType": "Graph", + "NodeType": "FunctionNode", + "Id": "a3cceaa601de4485beb72eea39a46f65", + "Inputs": [ + { + "Id": "a83f8affbd294adab130d8f0af11f68d", + "Name": "someInput", + "Description": "var[]..[]", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "d959a76782cb472bbe5dae220136d396", + "Name": "out2", + "Description": "return value", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "28031b992d1f4923959eb2b0562a545d", + "Name": "out1", + "Description": "return value", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Auto", + "Description": "testing nested element binding" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "NodeType": "FunctionNode", + "FunctionSignature": "FFITarget.WrapperObject.ID", + "Id": "da39dbe5f59649b18c2fb6ca54acba7b", + "Inputs": [ + { + "Id": "57657d3625f54b7c8fc3b6e5612618a7", + "Name": "wrapperObject", + "Description": "FFITarget.WrapperObject", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "537d03bde70b47d0b02b879668df989d", + "Name": "int", + "Description": "int", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Auto", + "Description": "WrapperObject.ID: int" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "NodeType": "FunctionNode", + "FunctionSignature": "FFITarget.WrapperObject.ID", + "Id": "2366239164a9441a8c4dcd981d9cf542", + "Inputs": [ + { + "Id": "7957f66d0e56481e9c7673de24179110", + "Name": "wrapperObject", + "Description": "FFITarget.WrapperObject", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "f45a46c44e7a48a793862160ab38365c", + "Name": "int", + "Description": "int", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Auto", + "Description": "WrapperObject.ID: int" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.CodeBlockNodeModel, DynamoCore", + "NodeType": "CodeBlockNode", + "Code": "100;", + "Id": "247d1b8751c64f8b8ac88e37cad98dff", + "Inputs": [], + "Outputs": [ + { + "Id": "12a69844634441d08df8ff2d1b3b0c42", + "Name": "", + "Description": "Value of expression at line 1", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Allows for DesignScript code to be authored directly" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "NodeType": "FunctionNode", + "FunctionSignature": "FFITarget.WrapperObject.ID", + "Id": "342f96575f8942c890867d88495fb0db", + "Inputs": [ + { + "Id": "7178d1186aee4a20b03be1e20ad0da64", + "Name": "wrapperObject", + "Description": "FFITarget.WrapperObject", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "b06f4f43fa7749b5856af632006d7806", + "Name": "int", + "Description": "int", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Auto", + "Description": "WrapperObject.ID: int" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "NodeType": "FunctionNode", + "FunctionSignature": "FFITarget.WrapperObject.WrapperObject@int", + "Id": "e464dfe1dfcf43698eb5e8efc11d1aae", + "Inputs": [ + { + "Id": "165c688d1cdf43eb863f95e12721700c", + "Name": "x", + "Description": "int", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "94b68073cf42449abbd5ecb25fb6fcbc", + "Name": "WrapperObject", + "Description": "WrapperObject", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Auto", + "Description": "WrapperObject.WrapperObject (x: int): WrapperObject" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.CustomNodes.Function, DynamoCore", + "FunctionSignature": "9c65f412-0637-4601-ba90-9de2f539224f", + "FunctionType": "Graph", + "NodeType": "FunctionNode", + "Id": "7d799d548e0344aab8debfb468b50166", + "Inputs": [ + { + "Id": "0a321e2157fe45268bcf46eed08e8cd3", + "Name": "someInput", + "Description": "var[]..[]", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "2aa9090e1843495295c4ce3cddd9459c", + "Name": "out2", + "Description": "return value", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "af8d68ecd22b45a1afe7c12190cf3300", + "Name": "out1", + "Description": "return value", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Auto", + "Description": "testing nested element binding" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "NodeType": "FunctionNode", + "FunctionSignature": "FFITarget.WrapperObject.ID", + "Id": "08448232ee094aad8280e9a99ed44f46", + "Inputs": [ + { + "Id": "8adfa0547e0d4784b59d352c45a9b4b9", + "Name": "wrapperObject", + "Description": "FFITarget.WrapperObject", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "c7ee12320e614211bf681715342f894a", + "Name": "int", + "Description": "int", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Auto", + "Description": "WrapperObject.ID: int" + }, + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "NodeType": "FunctionNode", + "FunctionSignature": "FFITarget.WrapperObject.ID", + "Id": "8cfce012280342f3bd688520d68a7f66", + "Inputs": [ + { + "Id": "d5cfa698e209433a8c4efd66b711d98c", + "Name": "wrapperObject", + "Description": "FFITarget.WrapperObject", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "bad1c4ea3f9242f2b2a7c9da5c5d6a66", + "Name": "int", + "Description": "int", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Auto", + "Description": "WrapperObject.ID: int" + } + ], + "Connectors": [ + { + "Start": "d959a76782cb472bbe5dae220136d396", + "End": "57657d3625f54b7c8fc3b6e5612618a7", + "Id": "3490d7fe3a8143f8b0da79608cec2db7" + }, + { + "Start": "28031b992d1f4923959eb2b0562a545d", + "End": "7957f66d0e56481e9c7673de24179110", + "Id": "fead1997c72544b79c6085f0047faf4c" + }, + { + "Start": "12a69844634441d08df8ff2d1b3b0c42", + "End": "165c688d1cdf43eb863f95e12721700c", + "Id": "5ca50e2c395e4304b14c86c45480de32" + }, + { + "Start": "b06f4f43fa7749b5856af632006d7806", + "End": "a83f8affbd294adab130d8f0af11f68d", + "Id": "79b1c4ec60014662896beb5cd6f9e219" + }, + { + "Start": "b06f4f43fa7749b5856af632006d7806", + "End": "0a321e2157fe45268bcf46eed08e8cd3", + "Id": "eeeff16f2f3f4eb583e82b66ef370777" + }, + { + "Start": "94b68073cf42449abbd5ecb25fb6fcbc", + "End": "7178d1186aee4a20b03be1e20ad0da64", + "Id": "fe46ec09fbe24401934b70dec0521e7a" + }, + { + "Start": "2aa9090e1843495295c4ce3cddd9459c", + "End": "d5cfa698e209433a8c4efd66b711d98c", + "Id": "bf0d54c88f41487e984f4ec706685b2c" + }, + { + "Start": "af8d68ecd22b45a1afe7c12190cf3300", + "End": "8adfa0547e0d4784b59d352c45a9b4b9", + "Id": "b2e0d33b549f4ad2a8f432ae785116c0" + } + ], + "Dependencies": [ + "9c65f412-0637-4601-ba90-9de2f539224f" + ], + "Bindings": [ + { + "NodeId": "a3cceaa6-01de-4485-beb7-2eea39a46f65", + "Binding": { + "__func_9c65f41206374601ba909de2f539224f_InClassDecl-1_InFunctionScope-1_Instance0_a3cceaa6-01de-4485-beb7-2eea39a46f65;WrapperObject_InClassDecl-1_InFunctionScope1000_Inst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SGFzTmVzdGVkRGF0YT5mYWxzZTwvQmFzZS0wX0hhc05lc3RlZERhdGE+CjwvYTE6Q2FsbFNpdGVfeDAwMkJfVHJhY2VTZXJpYWxpc2VySGVscGVyPgo8L1NPQVAtRU5WOkJvZHk+CjwvU09BUC1FTlY6RW52ZWxvcGU+Cg==", + "__func_9c65f41206374601ba909de2f539224f_InClassDecl-1_InFunctionScope-1_Instance0_a3cceaa6-01de-4485-beb7-2eea39a46f65;WrapperObject_InClassDecl-1_InFunctionScope1000_Instance0_3f04f5f4-f54d-4071-af6f-7d5db4e7706e": "PFNPQVAtRU5WOkVudmVsb3BlIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOlNPQVAtRU5DPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VuY29kaW5nLyIgeG1sbnM6U09BUC1FTlY9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIiB4bWxuczpjbHI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vc29hcC9lbmNvZGluZy9jbHIvMS4wIiBTT0FQLUVOVjplbmNvZGluZ1N0eWxlPSJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy9zb2FwL2VuY29kaW5nLyI+CjxTT0FQLUVOVjpCb2R5Pgo8YTE6Q2FsbFNpdGVfeDAwMkJfVHJhY2VTZXJpYWxpc2VySGVscGVyIGlkPSJyZWYtMSIgeG1sbnM6YTE9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vY2xyL25zYXNzZW0vUHJvdG9Db3JlL1Byb3RvQ29yZSUyQyUyMFZlcnNpb24lM0QyLjIuMC40NTY1JTJDJTIwQ3VsdHVyZSUzRG5ldXRyYWwlMkMl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aeTl6YjJGd0wyVnVZMjlrYVc1bkx5SStEUW84VTA5QlVDMUZUbFk2UW05a2VUNE5DanhoTVRwSlJFaHZiR1JsY2lCcFpEMGljbVZtTFRFaUlIaHRiRzV6T21FeFBTSm9kSFJ3T2k4dmMyTm9aVzFoY3k1dGFXTnliM052Wm5RdVkyOXRMMk5zY2k5dWMyRnpjMlZ0TDBaR1NWUmhjbWRsZEM5R1JrbFVZWEpuWlhRbE1rTWxNakJXWlhKemFXOXVKVE5FTWk0eUxqQXVORFV4TmlVeVF5VXlNRU4xYkhSMWNtVWxNMFJ1WlhWMGNtRnNKVEpESlRJd1VIVmliR2xqUzJWNVZHOXJaVzRsTTBSdWRXeHNJajROQ2p4cGJuUkpSRDR6UEM5cGJuUkpSRDROQ2p3dllURTZTVVJJYjJ4a1pYSStEUW84TDFOUFFWQXRSVTVXT2tKdlpIaytEUW84TDFOUFFWQXRSVTVXT2tWdWRtVnNiM0JsUGcwSzwvQmFzZS0wX0RhdGE+DQo8QmFzZS0wX0hhc05lc3RlZERhdGE+ZmFsc2U8L0Jhc2UtMF9IYXNOZXN0ZWREYXRhPg0KPC9hMTpDYWxsU2l0ZV94MDAyQl9UcmFjZVNlcmlhbGlzZXJIZWxwZXI+DQo8L1NPQVAtRU5WOkJvZHk+DQo8L1NPQVAtRU5WOkVudmVsb3BlPg0K" + } + }, + { + "NodeId": "7d799d54-8e03-44aa-b8de-bfb468b50166", + "Binding": { + "__func_9c65f41206374601ba909de2f539224f_InClassDecl-1_InFunctionScope-1_Instance0_7d799d54-8e03-44aa-b8de-bfb468b50166;WrapperObject_InClassDecl-1_InFunctionScope1000_Instance0_54062f33-ce19-49a3-a373-5d4a253e26a5": "PFNPQVAtRU5WOkVudmVsb3BlIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHh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0UlU1V09rSnZaSGsrQ2p3dlUwOUJVQzFGVGxZNlJXNTJaV3h2Y0dVKzwvQmFzZS0wX0RhdGE+CjxCYXNlLTBfSGFzTmVzdGVkRGF0YT5mYWxzZTwvQmFzZS0wX0hhc05lc3RlZERhdGE+CjwvYTE6Q2FsbFNpdGVfeDAwMkJfVHJhY2VTZXJpYWxpc2VySGVscGVyPgo8L1NPQVAtRU5WOkJvZHk+CjwvU09BUC1FTlY6RW52ZWxvcGU+Cg==" + } + } + ], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "2.2.0.4565", + "RunType": "Manual", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "Background Preview", + "EyeX": -17.0, + "EyeY": 24.0, + "EyeZ": 50.0, + "LookX": 12.0, + "LookY": -13.0, + "LookZ": -58.0, + "UpX": 0.0, + "UpY": 1.0, + "UpZ": 0.0 + }, + "NodeViews": [ + { + "ShowGeometry": true, + "Name": "element_binding_nested", + "Id": "a3cceaa601de4485beb72eea39a46f65", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": 400.5, + "Y": 419.25 + }, + { + "ShowGeometry": true, + "Name": "WrapperObject.ID_111111", + "Id": "da39dbe5f59649b18c2fb6ca54acba7b", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": 825.5, + "Y": 286.25 + }, + { + "ShowGeometry": true, + "Name": "WrapperObject.ID_222222", + "Id": "2366239164a9441a8c4dcd981d9cf542", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": 817.5, + "Y": 437.25 + }, + { + "ShowGeometry": true, + "Name": "Code Block", + "Id": "247d1b8751c64f8b8ac88e37cad98dff", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": -189.0, + "Y": 287.0 + }, + { + "ShowGeometry": true, + "Name": "WrapperObject.ID", + "Id": "342f96575f8942c890867d88495fb0db", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": -59.5, + "Y": 490.25 + }, + { + "ShowGeometry": true, + "Name": "WrapperObject.WrapperObject", + "Id": "e464dfe1dfcf43698eb5e8efc11d1aae", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": -56.5, + "Y": 393.25 + }, + { + "ShowGeometry": true, + "Name": "element_binding_nested", + "Id": "7d799d548e0344aab8debfb468b50166", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": 400.5, + "Y": 558.25 + }, + { + "ShowGeometry": true, + "Name": "WrapperObject.ID_444444", + "Id": "08448232ee094aad8280e9a99ed44f46", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": 837.5, + "Y": 744.25 + }, + { + "ShowGeometry": true, + "Name": "WrapperObject.ID_333333", + "Id": "8cfce012280342f3bd688520d68a7f66", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": 835.5, + "Y": 624.25 + } + ], + "Annotations": [], + "X": -435.0, + "Y": -220.0, + "Zoom": 1.0 + } +} \ No newline at end of file From 1b38c4d44a9b83204654d5e28e85ff6491c5d51c Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 20 Nov 2023 16:59:43 -0500 Subject: [PATCH 08/18] cleanup --- test/DynamoCoreTests/CallsiteTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/DynamoCoreTests/CallsiteTests.cs b/test/DynamoCoreTests/CallsiteTests.cs index 5ccff89091a..296bf8741a0 100644 --- a/test/DynamoCoreTests/CallsiteTests.cs +++ b/test/DynamoCoreTests/CallsiteTests.cs @@ -339,7 +339,7 @@ public void CanDetectLegacyTraceFormat() public void CanWarnAboutLegacyTraceData() { var counter = 99; - CurrentDynamoModel.RequestNotification += (msg, stayOpen) => { counter++; }; + CurrentDynamoModel.RequestNotification += (_, _) => { counter++; }; // Dyn file contains SOAP formatted trace data. var ws = Open(TestDirectory, callsiteDir, From a2a6256d62787ddb80575edc34df9f73feaea48d Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 20 Nov 2023 19:50:52 -0500 Subject: [PATCH 09/18] review comments --- src/DynamoCore/Properties/Resources.Designer.cs | 2 +- src/DynamoCore/Properties/Resources.en-US.resx | 2 +- src/DynamoCore/Properties/Resources.resx | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DynamoCore/Properties/Resources.Designer.cs b/src/DynamoCore/Properties/Resources.Designer.cs index 969c3abc65d..31864038d8b 100644 --- a/src/DynamoCore/Properties/Resources.Designer.cs +++ b/src/DynamoCore/Properties/Resources.Designer.cs @@ -1118,7 +1118,7 @@ public static string InvalidStartOrEndOfRange { } /// - /// Looks up a localized string similar to This workspace contains element binding data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. Element binding will work however, if any new trace data generated during graph execution is saved with the workspace.. + /// Looks up a localized string similar to This workspace contains element binding data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. Element binding data will be saved in the new format the next time you run and save this workspace.. /// public static string LegacyTraceDataWarning { get { diff --git a/src/DynamoCore/Properties/Resources.en-US.resx b/src/DynamoCore/Properties/Resources.en-US.resx index 5dc5c2079bb..ad2ca83d86c 100644 --- a/src/DynamoCore/Properties/Resources.en-US.resx +++ b/src/DynamoCore/Properties/Resources.en-US.resx @@ -909,6 +909,6 @@ This package likely contains an assembly that is blocked. You will need to load Formula node has been deprecated. It has been automatically migrated to a CodeBlock node. Note that results may vary after the migration depending on lacing options selected on the original Formula node. Appropriate replication guides might need to be applied to the CodeBlock node script. - This workspace contains element binding data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. Element binding will work however, if any new trace data generated during graph execution is saved with the workspace. + This workspace contains element binding data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. Element binding data will be saved in the new format the next time you run and save this workspace. \ No newline at end of file diff --git a/src/DynamoCore/Properties/Resources.resx b/src/DynamoCore/Properties/Resources.resx index 088587706bd..4306d13dc3a 100644 --- a/src/DynamoCore/Properties/Resources.resx +++ b/src/DynamoCore/Properties/Resources.resx @@ -912,6 +912,6 @@ This package likely contains an assembly that is blocked. You will need to load Formula node has been deprecated. It has been automatically migrated to a CodeBlock node. Note that results may vary after the migration depending on lacing options selected on the original Formula node. Appropriate replication guides might need to be applied to the CodeBlock node script. - This workspace contains element binding data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. Element binding will work however, if any new trace data generated during graph execution is saved with the workspace. + This workspace contains element binding data in a legacy format that is no longer supported in Dynamo 3.0 and higher versions. Element binding data will be saved in the new format the next time you run and save this workspace. - \ No newline at end of file + From 77cc25d4c81a53ff0f2effabf416d34c37f1b80a Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 22 Nov 2023 09:58:01 -0500 Subject: [PATCH 10/18] update tests --- src/DynamoCore/Models/DynamoModel.cs | 12 +++++++++--- test/DynamoCoreWpfTests/SerializationTests.cs | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/DynamoCore/Models/DynamoModel.cs b/src/DynamoCore/Models/DynamoModel.cs index 820f96f626b..3bc05622ab7 100644 --- a/src/DynamoCore/Models/DynamoModel.cs +++ b/src/DynamoCore/Models/DynamoModel.cs @@ -2325,9 +2325,12 @@ private bool OpenJsonFile( workspace.WorkspaceVersion = dynamoPreferences.Version == null ? AssemblyHelper.GetDynamoVersion() : new Version(dynamoPreferences.Version); - if (workspace.ContainsTraceData && workspace.WorkspaceVersion < new Version(3, 0, 0)) + if (!IsTestMode) { - OnRequestNotification(Resources.LegacyTraceDataWarning, true); + if (workspace.ContainsTraceData && workspace.WorkspaceVersion < new Version(3, 0, 0)) + { + OnRequestNotification(Resources.LegacyTraceDataWarning, true); + } } if (workspace is HomeWorkspaceModel homeWorkspace) @@ -2455,7 +2458,10 @@ private bool OpenXmlHomeWorkspace( Guid deterministicId = GuidUtility.Create(GuidUtility.UrlNamespace, workspaceInfo.Name); var loadedTraceData = Utils.LoadTraceDataFromXmlDocument(xmlDoc, out var containsTraceData); - if(containsTraceData) OnRequestNotification(Resources.LegacyTraceDataWarning, true); + if (!IsTestMode) + { + if (containsTraceData) OnRequestNotification(Resources.LegacyTraceDataWarning, true); + } var newWorkspace = new HomeWorkspaceModel( deterministicId, diff --git a/test/DynamoCoreWpfTests/SerializationTests.cs b/test/DynamoCoreWpfTests/SerializationTests.cs index aae2f7e7de8..418f4ee0f48 100644 --- a/test/DynamoCoreWpfTests/SerializationTests.cs +++ b/test/DynamoCoreWpfTests/SerializationTests.cs @@ -563,6 +563,7 @@ protected override void GetLibrariesToPreload(List libraries) libraries.Add("ProtoGeometry.dll"); libraries.Add("DesignScriptBuiltin.dll"); libraries.Add("DSCoreNodes.dll"); + libraries.Add("FFITarget.dll"); base.GetLibrariesToPreload(libraries); } From 16d50d4c8b7c3ffba761e3ef43df45d4d59a0bbf Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 22 Nov 2023 11:21:36 -0500 Subject: [PATCH 11/18] revert test fixture change --- test/DynamoCoreWpfTests/SerializationTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/DynamoCoreWpfTests/SerializationTests.cs b/test/DynamoCoreWpfTests/SerializationTests.cs index 418f4ee0f48..aae2f7e7de8 100644 --- a/test/DynamoCoreWpfTests/SerializationTests.cs +++ b/test/DynamoCoreWpfTests/SerializationTests.cs @@ -563,7 +563,6 @@ protected override void GetLibrariesToPreload(List libraries) libraries.Add("ProtoGeometry.dll"); libraries.Add("DesignScriptBuiltin.dll"); libraries.Add("DSCoreNodes.dll"); - libraries.Add("FFITarget.dll"); base.GetLibrariesToPreload(libraries); } From 97d5987742f86dc2651823d12fce46484d35f06d Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 22 Nov 2023 17:09:18 -0500 Subject: [PATCH 12/18] refactor, add test --- src/DynamoCore/Engine/EngineController.cs | 5 + .../Workspaces/CustomNodeWorkspaceModel.cs | 18 ---- .../Graph/Workspaces/HomeWorkspaceModel.cs | 19 +--- .../Workspaces/SerializationConverters.cs | 43 +++++---- .../Graph/Workspaces/WorkspaceModel.cs | 94 +------------------ src/DynamoCore/Migration/Migration.cs | 18 ---- src/DynamoCore/Models/DynamoModel.cs | 15 ++- test/DynamoCoreTests/SerializationTests.cs | 49 +++++++++- 8 files changed, 88 insertions(+), 173 deletions(-) diff --git a/src/DynamoCore/Engine/EngineController.cs b/src/DynamoCore/Engine/EngineController.cs index dbb7325a7e8..63946e702ed 100644 --- a/src/DynamoCore/Engine/EngineController.cs +++ b/src/DynamoCore/Engine/EngineController.cs @@ -10,6 +10,7 @@ using Dynamo.Graph.Workspaces; using Dynamo.Logging; using Dynamo.Scheduler; +using Dynamo.Utilities; using ProtoCore.AST.AssociativeAST; using ProtoCore.DSASM.Mirror; using ProtoCore.Mirror; @@ -44,6 +45,8 @@ public class EngineController : LogSourceBase, IAstNodeContainer, IDisposable /// internal static event Action VMLibrariesReset; + internal Version WorkspaceVersion { get; set; } + /// /// This event is fired when is completed. /// @@ -153,6 +156,8 @@ public EngineController(LibraryServices libraryServices, string geometryFactoryF syncDataManager = new SyncDataManager(); VerboseLogging = verboseLogging; + + WorkspaceVersion = AssemblyHelper.GetDynamoVersion(); } /// diff --git a/src/DynamoCore/Graph/Workspaces/CustomNodeWorkspaceModel.cs b/src/DynamoCore/Graph/Workspaces/CustomNodeWorkspaceModel.cs index cc3dc6bd1ab..547ffb8a67d 100644 --- a/src/DynamoCore/Graph/Workspaces/CustomNodeWorkspaceModel.cs +++ b/src/DynamoCore/Graph/Workspaces/CustomNodeWorkspaceModel.cs @@ -315,23 +315,5 @@ public override void Save(string newPath, bool isBackup = false, EngineControlle base.Save(newPath, isBackup, engine); } - - [Obsolete("Method will be deprecated in Dynamo 3.0.")] - protected override bool PopulateXmlDocument(XmlDocument document) - { - if (!base.PopulateXmlDocument(document)) - return false; - - var root = document.DocumentElement; - if (root == null) - return false; - - var guid = CustomNodeDefinition != null ? CustomNodeDefinition.FunctionId : Guid.NewGuid(); - root.SetAttribute("ID", guid.ToString()); - root.SetAttribute("Description", Description); - root.SetAttribute("Category", Category); - - return true; - } } } diff --git a/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs b/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs index d5a3274e26c..1a44e5c74e2 100644 --- a/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs +++ b/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs @@ -664,24 +664,7 @@ internal void StopPeriodicEvaluation() } #endregion - - [Obsolete("Method will be deprecated in Dynamo 3.0.")] - protected override bool PopulateXmlDocument(XmlDocument document) - { - if (!base.PopulateXmlDocument(document)) - return false; - - var root = document.DocumentElement; - if (root == null) - return false; - - root.SetAttribute("RunType", RunSettings.RunType.ToString()); - root.SetAttribute("RunPeriod", RunSettings.RunPeriod.ToString(CultureInfo.InvariantCulture)); - root.SetAttribute("HasRunWithoutCrash", HasRunWithoutCrash.ToString(CultureInfo.InvariantCulture)); - - return true; - } - + private void PulseMakerRunStarted() { var nodesToUpdate = Nodes.Where(n => n.CanUpdatePeriodically); diff --git a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs index 06d2b0a6dc3..c7e05e5c1fa 100644 --- a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs +++ b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs @@ -18,6 +18,7 @@ using Dynamo.Library; using Dynamo.Linting; using Dynamo.Logging; +using Dynamo.Models; using Dynamo.Properties; using Dynamo.Scheduler; using Dynamo.Utilities; @@ -679,30 +680,38 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist #region Restore trace data // Trace Data Dictionary> loadedTraceData = new Dictionary>(); - bool containsTraceData = false; + bool containsLegacyTraceData = false; // Restore trace data if bindings are present in json if (obj["Bindings"] != null && obj["Bindings"].Children().Count() > 0) { - containsTraceData = true; - - JEnumerable bindings = obj["Bindings"].Children(); + var wrc = (WorkspaceReadConverter)serializer.Converters.First(c => c is WorkspaceReadConverter); - // Iterate through bindings to extract nodeID's and bindingData (callsiteId & traceData) - foreach (JToken entity in bindings) + if (wrc.engine.WorkspaceVersion < new Version(3, 0, 0)) { - Guid nodeId = Guid.Parse(entity["NodeId"].ToString()); - string bindingString = entity["Binding"].ToString(); - - // Key(callsiteId) : Value(traceData) - Dictionary bindingData = JsonConvert.DeserializeObject>(bindingString); - List callsiteTraceData = new List(); + containsLegacyTraceData = true; + } + else + { + JEnumerable bindings = obj["Bindings"].Children(); - foreach (KeyValuePair pair in bindingData) + // Iterate through bindings to extract nodeID's and bindingData (callsiteId & traceData) + foreach (JToken entity in bindings) { - callsiteTraceData.Add(new CallSite.RawTraceData(pair.Key, pair.Value)); - } + Guid nodeId = Guid.Parse(entity["NodeId"].ToString()); + string bindingString = entity["Binding"].ToString(); - loadedTraceData.Add(nodeId, callsiteTraceData); + // Key(callsiteId) : Value(traceData) + Dictionary bindingData = + JsonConvert.DeserializeObject>(bindingString); + List callsiteTraceData = new List(); + + foreach (KeyValuePair pair in bindingData) + { + callsiteTraceData.Add(new CallSite.RawTraceData(pair.Key, pair.Value)); + } + + loadedTraceData.Add(nodeId, callsiteTraceData); + } } } #endregion @@ -751,7 +760,7 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist if (obj.TryGetValue(nameof(WorkspaceModel.Author), StringComparison.OrdinalIgnoreCase, out JToken author)) ws.Author = author.ToString(); - ws.ContainsTraceData = containsTraceData; + ws.ContainsLegacyTraceData = containsLegacyTraceData; return ws; } diff --git a/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs b/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs index e7ff4b05e45..d14b253d8d2 100644 --- a/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs +++ b/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs @@ -233,7 +233,7 @@ internal int CurrentPasteOffset } } - internal bool ContainsTraceData { get; set; } + internal bool ContainsLegacyTraceData { get; set; } internal bool ScaleFactorChanged = false; @@ -1282,9 +1282,6 @@ public Rect2D Rect get { return new Rect2D(x, y, width, height); } } - //TODO(Steve): This probably isn't needed inside of WorkspaceModel -- MAGN-5714 - internal Version WorkspaceVersion { get; set; } - /// /// Implements property. /// @@ -1374,7 +1371,6 @@ protected WorkspaceModel( IsReadOnly = DynamoUtilities.PathHelper.IsReadOnlyPath(fileName); LastSaved = DateTime.Now; - WorkspaceVersion = AssemblyHelper.GetDynamoVersion(); undoRecorder = new UndoRedoRecorder(this); NodeFactory = factory; @@ -2064,94 +2060,6 @@ private void SerializeElementResolver(XmlDocument xmlDoc) root.AppendChild(mapElement); } - [Obsolete("Method will be deprecated in Dynamo 3.0.")] - protected virtual bool PopulateXmlDocument(XmlDocument xmlDoc) - { - try - { - var root = xmlDoc.DocumentElement; - root.SetAttribute("Version", WorkspaceVersion.ToString()); - root.SetAttribute("X", X.ToString(CultureInfo.InvariantCulture)); - root.SetAttribute("Y", Y.ToString(CultureInfo.InvariantCulture)); - root.SetAttribute("ScaleFactor", ScaleFactor.ToString(CultureInfo.InvariantCulture)); - root.SetAttribute("Name", Name); - root.SetAttribute("Description", Description); - - SerializeElementResolver(xmlDoc); - - var elementList = xmlDoc.CreateElement("Elements"); - //write the root element - root.AppendChild(elementList); - - foreach (var dynEl in Nodes.Select(el => el.Serialize(xmlDoc, SaveContext.Save))) - elementList.AppendChild(dynEl); - - //write only the output connectors - var connectorList = xmlDoc.CreateElement("Connectors"); - //write the root element - root.AppendChild(connectorList); - - foreach (var el in Nodes) - { - foreach (var port in el.OutPorts) - { - foreach ( - var c in - port.Connectors.Where(c => c.Start != null && c.End != null)) - { - var connector = xmlDoc.CreateElement(c.GetType().ToString()); - connectorList.AppendChild(connector); - connector.SetAttribute("start", c.Start.Owner.GUID.ToString()); - connector.SetAttribute("start_index", c.Start.Index.ToString()); - connector.SetAttribute("end", c.End.Owner.GUID.ToString()); - connector.SetAttribute("end_index", c.End.Index.ToString()); - connector.SetAttribute(nameof(ConnectorModel.IsHidden), c.IsHidden.ToString()); - - if (c.End.PortType == PortType.Input) - connector.SetAttribute("portType", "0"); - } - } - } - - //save the notes - var noteList = xmlDoc.CreateElement("Notes"); //write the root element - root.AppendChild(noteList); - foreach (var n in Notes) - { - var note = n.Serialize(xmlDoc, SaveContext.Save); - noteList.AppendChild(note); - } - - //save the annotation - var annotationList = xmlDoc.CreateElement("Annotations"); - root.AppendChild(annotationList); - foreach (var n in annotations) - { - var annotation = n.Serialize(xmlDoc, SaveContext.Save); - annotationList.AppendChild(annotation); - } - - //save the presets into the dyn file as a seperate element on the root - var presetsElement = xmlDoc.CreateElement("Presets"); - root.AppendChild(presetsElement); - foreach (var preset in Presets) - { - var presetState = preset.Serialize(xmlDoc, SaveContext.Save); - presetsElement.AppendChild(presetState); - } - - OnSaving(xmlDoc); - - return true; - } - catch (Exception ex) - { - Log(ex.Message); - Log(ex.StackTrace); - return false; - } - } - internal void SendModelEvent(Guid modelGuid, string eventName, int value) { var retrievedModel = GetModelInternal(modelGuid); diff --git a/src/DynamoCore/Migration/Migration.cs b/src/DynamoCore/Migration/Migration.cs index cfea89aef8d..a3114f13274 100644 --- a/src/DynamoCore/Migration/Migration.cs +++ b/src/DynamoCore/Migration/Migration.cs @@ -517,24 +517,6 @@ internal static Version VersionFromString(string version) return new Version(ver.Major, ver.Minor, ver.Build, 0); } - /// - /// Call this method to obtain the version of current WorkspaceModel. - /// Note that the revision number is dropped as both "0.7.0.1234" - /// should be treated as the same version as "0.7.0.5678", and no file - /// migration should take place. - /// - /// The WorkspaceModel to get the Version from. - /// - /// Returns the Version object representing the workspace - /// version with the revision set to 0. - /// - internal static Version VersionFromWorkspace(WorkspaceModel workspace) - { - // Ignore revision number. - var ver = workspace.WorkspaceVersion; - return new Version(ver.Major, ver.Minor, ver.Build, 0); - } - /// /// Call this method to determine if migration should take place /// for the input DYN/DYF file based on the given version numbers. diff --git a/src/DynamoCore/Models/DynamoModel.cs b/src/DynamoCore/Models/DynamoModel.cs index 54425000367..50f6d7ac3be 100644 --- a/src/DynamoCore/Models/DynamoModel.cs +++ b/src/DynamoCore/Models/DynamoModel.cs @@ -2323,6 +2323,10 @@ private bool OpenJsonFile( var currentHomeSpace = Workspaces.OfType().FirstOrDefault(); currentHomeSpace.UndefineCBNFunctionDefinitions(); + // This is to handle the case of opening a JSON file that does not have a version string + EngineController.WorkspaceVersion = dynamoPreferences.Version == + null ? AssemblyHelper.GetDynamoVersion() : new Version(dynamoPreferences.Version); + // TODO, QNTM-1108: WorkspaceModel.FromJson does not check a schema and so will not fail as long // as the fileContents are valid JSON, regardless of if all required data is present or not workspace = WorkspaceModel.FromJson( @@ -2339,15 +2343,10 @@ private bool OpenJsonFile( workspace.FileName = string.IsNullOrEmpty(filePath) ? "" : filePath; workspace.FromJsonGraphId = string.IsNullOrEmpty(filePath) ? WorkspaceModel.ComputeGraphIdFromJson(fileContents) : ""; workspace.ScaleFactor = dynamoPreferences.ScaleFactor; - - - // This is to handle the case of opening a JSON file that does not have a version string - workspace.WorkspaceVersion = dynamoPreferences.Version == - null ? AssemblyHelper.GetDynamoVersion() : new Version(dynamoPreferences.Version); - + if (!IsTestMode) { - if (workspace.ContainsTraceData && workspace.WorkspaceVersion < new Version(3, 0, 0)) + if (workspace.ContainsLegacyTraceData) { OnRequestNotification(Resources.LegacyTraceDataWarning, true); } @@ -3215,7 +3214,7 @@ public void ClearCurrentWorkspace() //don't save the file path CurrentWorkspace.FileName = ""; CurrentWorkspace.HasUnsavedChanges = false; - CurrentWorkspace.WorkspaceVersion = AssemblyHelper.GetDynamoVersion(); + EngineController.WorkspaceVersion = AssemblyHelper.GetDynamoVersion(); this.LinterManager?.SetDefaultLinter(); diff --git a/test/DynamoCoreTests/SerializationTests.cs b/test/DynamoCoreTests/SerializationTests.cs index 21faa8ee02c..cd162430938 100644 --- a/test/DynamoCoreTests/SerializationTests.cs +++ b/test/DynamoCoreTests/SerializationTests.cs @@ -3,9 +3,9 @@ using System.Globalization; using System.IO; using System.Linq; -using System.Threading; using CoreNodeModels; using DesignScript.Builtin; +using DSCore; using Dynamo.Engine; using Dynamo.Engine.NodeToCode; using Dynamo.Events; @@ -20,6 +20,11 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using NUnit.Framework; +using ProtoCore; +using String = System.String; +using Thread = System.Threading.Thread; +using TimeSpan = System.TimeSpan; +using Type = System.Type; namespace Dynamo.Tests { @@ -617,6 +622,7 @@ protected override void GetLibrariesToPreload(List libraries) libraries.Add("ProtoGeometry.dll"); libraries.Add("DesignScriptBuiltin.dll"); libraries.Add("DSCoreNodes.dll"); + libraries.Add("FFITarget.dll"); base.GetLibrariesToPreload(libraries); } @@ -958,6 +964,47 @@ public void SerializationTest(string filePath) serializationTestUtils.SaveWorkspaceComparisonData); } + [Test] + public void JsonTraceSerializationTest() + { + // Contains trace data in old SOAP format + var filePath = Path.Combine(TestDirectory, + @"core\callsite\element_binding_customNodes_modified_multiple_pre3.0.dyn"); + + OpenModel(filePath); + var model = CurrentDynamoModel; + + if (((HomeWorkspaceModel)model.CurrentWorkspace).RunSettings.RunType == Dynamo.Models.RunType.Manual) + { + RunCurrentModel(); + } + var json = model.CurrentWorkspace.ToJson(model.EngineController); + Assert.That(json, Is.Not.Null.Or.Empty); + + var obj = Data.ParseJSON(json) as Dictionary; + var bindings = obj["Bindings"]; + + var list = (bindings as IEnumerable).ToList(); + Assert.AreEqual(3, list.Count); + int i = 0; + foreach (var elem in list) + { + var traces = ((elem as Dictionary)["Binding"] as Dictionary).Values; + if (i == 0 || i == 2) + { + Assert.AreEqual(2, traces.Count); + } + else Assert.AreEqual(1, traces.Count); + + foreach (var trace in traces) + { + // Assert that new bindings are not in SOAP format. + Assert.False(CallSite.CheckIfTraceDataIsLegacySOAPFormat(trace as string)); + } + ++i; + } + } + /// /// This parameterized test finds all .dyn files in directories within /// the test directory, opens them and executes, then converts them to From 3e0cbd56b63b59bb6160590a6945986abd388cdf Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 22 Nov 2023 17:17:55 -0500 Subject: [PATCH 13/18] cleanup --- src/DynamoCore/Engine/EngineController.cs | 1 - src/DynamoCore/Graph/Nodes/NodeCategories.cs | 2 -- src/DynamoCore/Graph/Workspaces/CustomNodeWorkspaceModel.cs | 1 - src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs | 3 --- src/DynamoCore/Graph/Workspaces/SerializationConverters.cs | 1 - src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs | 1 - src/DynamoCore/Models/DynamoModel.cs | 1 - test/DynamoCoreTests/SerializationTests.cs | 3 --- 8 files changed, 13 deletions(-) diff --git a/src/DynamoCore/Engine/EngineController.cs b/src/DynamoCore/Engine/EngineController.cs index 63946e702ed..647510e6694 100644 --- a/src/DynamoCore/Engine/EngineController.cs +++ b/src/DynamoCore/Engine/EngineController.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Runtime.Serialization; using Dynamo.Engine.CodeCompletion; using Dynamo.Engine.CodeGeneration; using Dynamo.Engine.NodeToCode; diff --git a/src/DynamoCore/Graph/Nodes/NodeCategories.cs b/src/DynamoCore/Graph/Nodes/NodeCategories.cs index cbb4231d6e5..13accef2bb5 100644 --- a/src/DynamoCore/Graph/Nodes/NodeCategories.cs +++ b/src/DynamoCore/Graph/Nodes/NodeCategories.cs @@ -7,8 +7,6 @@ using System.Xml; using Dynamo.Configuration; using Dynamo.Engine; -using Dynamo.Graph.Nodes.CustomNodes; -using Dynamo.Graph.Workspaces; using Dynamo.Library; using ProtoCore; diff --git a/src/DynamoCore/Graph/Workspaces/CustomNodeWorkspaceModel.cs b/src/DynamoCore/Graph/Workspaces/CustomNodeWorkspaceModel.cs index 547ffb8a67d..add23d7f767 100644 --- a/src/DynamoCore/Graph/Workspaces/CustomNodeWorkspaceModel.cs +++ b/src/DynamoCore/Graph/Workspaces/CustomNodeWorkspaceModel.cs @@ -4,7 +4,6 @@ using System.Diagnostics; using System.IO; using System.Linq; -using System.Xml; using Dynamo.Engine; using Dynamo.Graph.Annotations; using Dynamo.Graph.Nodes; diff --git a/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs b/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs index 1a44e5c74e2..fece34b574f 100644 --- a/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs +++ b/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs @@ -1,10 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Globalization; using System.Linq; -using System.Runtime.Serialization; -using System.Xml; using Dynamo.Core; using Dynamo.Engine; using Dynamo.Events; diff --git a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs index c7e05e5c1fa..6e9b641c905 100644 --- a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs +++ b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs @@ -18,7 +18,6 @@ using Dynamo.Library; using Dynamo.Linting; using Dynamo.Logging; -using Dynamo.Models; using Dynamo.Properties; using Dynamo.Scheduler; using Dynamo.Utilities; diff --git a/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs b/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs index d14b253d8d2..2d591d244ed 100644 --- a/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs +++ b/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs @@ -8,7 +8,6 @@ using System.Reflection; using System.Threading; using System.Xml; -using Dynamo.Configuration; using Dynamo.Core; using Dynamo.Engine; using Dynamo.Engine.CodeGeneration; diff --git a/src/DynamoCore/Models/DynamoModel.cs b/src/DynamoCore/Models/DynamoModel.cs index 50f6d7ac3be..1396d832b68 100644 --- a/src/DynamoCore/Models/DynamoModel.cs +++ b/src/DynamoCore/Models/DynamoModel.cs @@ -8,7 +8,6 @@ using System.IO; using System.Linq; using System.Reflection; -using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; using System.Xml; diff --git a/test/DynamoCoreTests/SerializationTests.cs b/test/DynamoCoreTests/SerializationTests.cs index cd162430938..719dbe8479d 100644 --- a/test/DynamoCoreTests/SerializationTests.cs +++ b/test/DynamoCoreTests/SerializationTests.cs @@ -3,20 +3,17 @@ using System.Globalization; using System.IO; using System.Linq; -using CoreNodeModels; using DesignScript.Builtin; using DSCore; using Dynamo.Engine; using Dynamo.Engine.NodeToCode; using Dynamo.Events; -using Dynamo.Graph; using Dynamo.Graph.Nodes; using Dynamo.Graph.Nodes.CustomNodes; using Dynamo.Graph.Nodes.ZeroTouch; using Dynamo.Graph.Workspaces; using Dynamo.Models; using Dynamo.Utilities; -using Moq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using NUnit.Framework; From d8e2dc205e5160ffe407f4b7f92da7f6de27f165 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 22 Nov 2023 17:34:49 -0500 Subject: [PATCH 14/18] rename --- src/DynamoCore/Graph/Nodes/NodeCategories.cs | 8 ++++---- src/DynamoCore/Models/DynamoModel.cs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/DynamoCore/Graph/Nodes/NodeCategories.cs b/src/DynamoCore/Graph/Nodes/NodeCategories.cs index 13accef2bb5..47f94374d94 100644 --- a/src/DynamoCore/Graph/Nodes/NodeCategories.cs +++ b/src/DynamoCore/Graph/Nodes/NodeCategories.cs @@ -281,7 +281,7 @@ internal static string GetDocumentXmlPath(XmlDocument document) /// Returns a dictionary of deserialized node-data-list pairs /// loaded from the given XmlDocument. internal static IEnumerable>> - LoadTraceDataFromXmlDocument(XmlDocument document, out bool containsTraceData) + LoadTraceDataFromXmlDocument(XmlDocument document, out bool containsLegacyTraceData) { if (document == null) throw new ArgumentNullException("document"); @@ -301,7 +301,7 @@ where childNode.Name.Equals(sessionXmlTagName) var loadedData = new Dictionary>(); if (!query.Any()) // There's no data, return empty dictionary. { - containsTraceData = false; + containsLegacyTraceData = false; return loadedData; } @@ -315,12 +315,12 @@ where childNode.Name.Equals(sessionXmlTagName) var callsiteId = string.Empty; if (child.HasAttribute(Configurations.CallSiteID)) { - containsTraceData = true; + containsLegacyTraceData = true; return loadedData; } } } - containsTraceData = false; + containsLegacyTraceData = false; return loadedData; } diff --git a/src/DynamoCore/Models/DynamoModel.cs b/src/DynamoCore/Models/DynamoModel.cs index 1396d832b68..0170915945f 100644 --- a/src/DynamoCore/Models/DynamoModel.cs +++ b/src/DynamoCore/Models/DynamoModel.cs @@ -2475,10 +2475,10 @@ private bool OpenXmlHomeWorkspace( var nodeGraph = NodeGraph.LoadGraphFromXml(xmlDoc, NodeFactory); Guid deterministicId = GuidUtility.Create(GuidUtility.UrlNamespace, workspaceInfo.Name); - var loadedTraceData = Utils.LoadTraceDataFromXmlDocument(xmlDoc, out var containsTraceData); + var loadedTraceData = Utils.LoadTraceDataFromXmlDocument(xmlDoc, out var containsLegacyTraceData); if (!IsTestMode) { - if (containsTraceData) OnRequestNotification(Resources.LegacyTraceDataWarning, true); + if (containsLegacyTraceData) OnRequestNotification(Resources.LegacyTraceDataWarning, true); } var newWorkspace = new HomeWorkspaceModel( From 71eb83c319c6eed78a88a0d0d2c8a40fbf1a8154 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Wed, 22 Nov 2023 17:48:05 -0500 Subject: [PATCH 15/18] review comments --- src/DynamoCore/Engine/EngineController.cs | 7 +++++-- src/DynamoCore/Graph/Workspaces/SerializationConverters.cs | 4 ++-- src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs | 3 +++ src/DynamoCore/Models/DynamoModel.cs | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/DynamoCore/Engine/EngineController.cs b/src/DynamoCore/Engine/EngineController.cs index 647510e6694..63b9b665a95 100644 --- a/src/DynamoCore/Engine/EngineController.cs +++ b/src/DynamoCore/Engine/EngineController.cs @@ -44,7 +44,10 @@ public class EngineController : LogSourceBase, IAstNodeContainer, IDisposable /// internal static event Action VMLibrariesReset; - internal Version WorkspaceVersion { get; set; } + /// + /// Dynamo version in which the current workspace was last created or modified. + /// + internal Version CurrentWorkspaceVersion { get; set; } /// /// This event is fired when is completed. @@ -156,7 +159,7 @@ public EngineController(LibraryServices libraryServices, string geometryFactoryF VerboseLogging = verboseLogging; - WorkspaceVersion = AssemblyHelper.GetDynamoVersion(); + CurrentWorkspaceVersion = AssemblyHelper.GetDynamoVersion(); } /// diff --git a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs index 6e9b641c905..4fa4b7dda3d 100644 --- a/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs +++ b/src/DynamoCore/Graph/Workspaces/SerializationConverters.cs @@ -683,9 +683,9 @@ public override object ReadJson(JsonReader reader, Type objectType, object exist // Restore trace data if bindings are present in json if (obj["Bindings"] != null && obj["Bindings"].Children().Count() > 0) { - var wrc = (WorkspaceReadConverter)serializer.Converters.First(c => c is WorkspaceReadConverter); + var wrc = serializer.Converters.First(c => c is WorkspaceReadConverter) as WorkspaceReadConverter; - if (wrc.engine.WorkspaceVersion < new Version(3, 0, 0)) + if (wrc.engine.CurrentWorkspaceVersion < new Version(3, 0, 0)) { containsLegacyTraceData = true; } diff --git a/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs b/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs index 2d591d244ed..f11681ff4fe 100644 --- a/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs +++ b/src/DynamoCore/Graph/Workspaces/WorkspaceModel.cs @@ -232,6 +232,9 @@ internal int CurrentPasteOffset } } + /// + /// This is true only if the workspace contains legacy SOAP formatted binding data. + /// internal bool ContainsLegacyTraceData { get; set; } internal bool ScaleFactorChanged = false; diff --git a/src/DynamoCore/Models/DynamoModel.cs b/src/DynamoCore/Models/DynamoModel.cs index 0170915945f..9876445af77 100644 --- a/src/DynamoCore/Models/DynamoModel.cs +++ b/src/DynamoCore/Models/DynamoModel.cs @@ -2323,7 +2323,7 @@ private bool OpenJsonFile( currentHomeSpace.UndefineCBNFunctionDefinitions(); // This is to handle the case of opening a JSON file that does not have a version string - EngineController.WorkspaceVersion = dynamoPreferences.Version == + EngineController.CurrentWorkspaceVersion = dynamoPreferences.Version == null ? AssemblyHelper.GetDynamoVersion() : new Version(dynamoPreferences.Version); // TODO, QNTM-1108: WorkspaceModel.FromJson does not check a schema and so will not fail as long @@ -3213,7 +3213,7 @@ public void ClearCurrentWorkspace() //don't save the file path CurrentWorkspace.FileName = ""; CurrentWorkspace.HasUnsavedChanges = false; - EngineController.WorkspaceVersion = AssemblyHelper.GetDynamoVersion(); + EngineController.CurrentWorkspaceVersion = AssemblyHelper.GetDynamoVersion(); this.LinterManager?.SetDefaultLinter(); From e5a56edea3f27d95a02cfca065205b7b8c4e7bea Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 27 Nov 2023 10:28:17 -0500 Subject: [PATCH 16/18] update tests --- test/DynamoCoreTests/CallsiteTests.cs | 3 +++ test/DynamoCoreTests/SerializationTests.cs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/DynamoCoreTests/CallsiteTests.cs b/test/DynamoCoreTests/CallsiteTests.cs index 296bf8741a0..002b2e26f8f 100644 --- a/test/DynamoCoreTests/CallsiteTests.cs +++ b/test/DynamoCoreTests/CallsiteTests.cs @@ -11,6 +11,7 @@ using Dynamo.Graph.Nodes.CustomNodes; using Dynamo.Graph.Nodes.ZeroTouch; using Dynamo.Graph.Workspaces; +using Dynamo.Models; using FFITarget; using NUnit.Framework; using ProtoCore; @@ -338,6 +339,7 @@ public void CanDetectLegacyTraceFormat() [Test] public void CanWarnAboutLegacyTraceData() { + DynamoModel.IsTestMode = false; var counter = 99; CurrentDynamoModel.RequestNotification += (_, _) => { counter++; }; @@ -345,6 +347,7 @@ public void CanWarnAboutLegacyTraceData() var ws = Open(TestDirectory, callsiteDir, "element_binding_customNodes_modified_multiple_pre3.0.dyn"); + DynamoModel.IsTestMode = true; Assert.AreEqual(100, counter); } } diff --git a/test/DynamoCoreTests/SerializationTests.cs b/test/DynamoCoreTests/SerializationTests.cs index 719dbe8479d..226dd780ec4 100644 --- a/test/DynamoCoreTests/SerializationTests.cs +++ b/test/DynamoCoreTests/SerializationTests.cs @@ -619,7 +619,7 @@ protected override void GetLibrariesToPreload(List libraries) libraries.Add("ProtoGeometry.dll"); libraries.Add("DesignScriptBuiltin.dll"); libraries.Add("DSCoreNodes.dll"); - libraries.Add("FFITarget.dll"); + //libraries.Add("FFITarget.dll"); base.GetLibrariesToPreload(libraries); } From 456c20e2a3cef64a11b20904819d7a677af9cbea Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 27 Nov 2023 10:35:51 -0500 Subject: [PATCH 17/18] update tests --- test/DynamoCoreTests/CallsiteTests.cs | 42 ++++++++++++++++++++++ test/DynamoCoreTests/SerializationTests.cs | 42 ---------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/test/DynamoCoreTests/CallsiteTests.cs b/test/DynamoCoreTests/CallsiteTests.cs index 002b2e26f8f..e01c3e3a3b7 100644 --- a/test/DynamoCoreTests/CallsiteTests.cs +++ b/test/DynamoCoreTests/CallsiteTests.cs @@ -6,6 +6,7 @@ using System.Reflection; using System.Runtime.Serialization; using CoreNodeModels.Input; +using DSCore; using Dynamo.Engine; using Dynamo.Graph.Nodes; using Dynamo.Graph.Nodes.CustomNodes; @@ -350,5 +351,46 @@ public void CanWarnAboutLegacyTraceData() DynamoModel.IsTestMode = true; Assert.AreEqual(100, counter); } + + [Test] + public void JsonTraceSerializationTest() + { + // Contains trace data in old SOAP format + var filePath = Path.Combine(TestDirectory, + @"core\callsite\element_binding_customNodes_modified_multiple_pre3.0.dyn"); + + OpenModel(filePath); + var model = CurrentDynamoModel; + + if (((HomeWorkspaceModel)model.CurrentWorkspace).RunSettings.RunType == Dynamo.Models.RunType.Manual) + { + RunCurrentModel(); + } + var json = model.CurrentWorkspace.ToJson(model.EngineController); + Assert.That(json, Is.Not.Null.Or.Empty); + + var obj = Data.ParseJSON(json) as Dictionary; + var bindings = obj["Bindings"]; + + var list = (bindings as IEnumerable).ToList(); + Assert.AreEqual(3, list.Count); + int i = 0; + foreach (var elem in list) + { + var traces = ((elem as Dictionary)["Binding"] as Dictionary).Values; + if (i == 0 || i == 2) + { + Assert.AreEqual(2, traces.Count); + } + else Assert.AreEqual(1, traces.Count); + + foreach (var trace in traces) + { + // Assert that new bindings are not in SOAP format. + Assert.False(CallSite.CheckIfTraceDataIsLegacySOAPFormat(trace as string)); + } + ++i; + } + } } } diff --git a/test/DynamoCoreTests/SerializationTests.cs b/test/DynamoCoreTests/SerializationTests.cs index 226dd780ec4..c39acb5462f 100644 --- a/test/DynamoCoreTests/SerializationTests.cs +++ b/test/DynamoCoreTests/SerializationTests.cs @@ -619,7 +619,6 @@ protected override void GetLibrariesToPreload(List libraries) libraries.Add("ProtoGeometry.dll"); libraries.Add("DesignScriptBuiltin.dll"); libraries.Add("DSCoreNodes.dll"); - //libraries.Add("FFITarget.dll"); base.GetLibrariesToPreload(libraries); } @@ -961,47 +960,6 @@ public void SerializationTest(string filePath) serializationTestUtils.SaveWorkspaceComparisonData); } - [Test] - public void JsonTraceSerializationTest() - { - // Contains trace data in old SOAP format - var filePath = Path.Combine(TestDirectory, - @"core\callsite\element_binding_customNodes_modified_multiple_pre3.0.dyn"); - - OpenModel(filePath); - var model = CurrentDynamoModel; - - if (((HomeWorkspaceModel)model.CurrentWorkspace).RunSettings.RunType == Dynamo.Models.RunType.Manual) - { - RunCurrentModel(); - } - var json = model.CurrentWorkspace.ToJson(model.EngineController); - Assert.That(json, Is.Not.Null.Or.Empty); - - var obj = Data.ParseJSON(json) as Dictionary; - var bindings = obj["Bindings"]; - - var list = (bindings as IEnumerable).ToList(); - Assert.AreEqual(3, list.Count); - int i = 0; - foreach (var elem in list) - { - var traces = ((elem as Dictionary)["Binding"] as Dictionary).Values; - if (i == 0 || i == 2) - { - Assert.AreEqual(2, traces.Count); - } - else Assert.AreEqual(1, traces.Count); - - foreach (var trace in traces) - { - // Assert that new bindings are not in SOAP format. - Assert.False(CallSite.CheckIfTraceDataIsLegacySOAPFormat(trace as string)); - } - ++i; - } - } - /// /// This parameterized test finds all .dyn files in directories within /// the test directory, opens them and executes, then converts them to From 0c03fafad66534dbdcc13f0b3f36c5d5d1a88a76 Mon Sep 17 00:00:00 2001 From: Aparajit Pratap Date: Mon, 27 Nov 2023 11:56:13 -0500 Subject: [PATCH 18/18] revert unchanged test file --- test/DynamoCoreTests/SerializationTests.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/DynamoCoreTests/SerializationTests.cs b/test/DynamoCoreTests/SerializationTests.cs index c39acb5462f..21faa8ee02c 100644 --- a/test/DynamoCoreTests/SerializationTests.cs +++ b/test/DynamoCoreTests/SerializationTests.cs @@ -3,25 +3,23 @@ using System.Globalization; using System.IO; using System.Linq; +using System.Threading; +using CoreNodeModels; using DesignScript.Builtin; -using DSCore; using Dynamo.Engine; using Dynamo.Engine.NodeToCode; using Dynamo.Events; +using Dynamo.Graph; using Dynamo.Graph.Nodes; using Dynamo.Graph.Nodes.CustomNodes; using Dynamo.Graph.Nodes.ZeroTouch; using Dynamo.Graph.Workspaces; using Dynamo.Models; using Dynamo.Utilities; +using Moq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using NUnit.Framework; -using ProtoCore; -using String = System.String; -using Thread = System.Threading.Thread; -using TimeSpan = System.TimeSpan; -using Type = System.Type; namespace Dynamo.Tests {