From 9a43509133716ad831f480d664bab8f5e3e447dc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 23:47:23 +0000 Subject: [PATCH 1/2] Initial plan From d5b4971786e624c442b1c1e1e5784ae7cd179002 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 23:52:22 +0000 Subject: [PATCH 2/2] Fix List.MaximumItem and List.MinimumItem to preserve original type instead of promoting to Double Agent-Logs-Url: https://github.com/DynamoDS/Dynamo/sessions/d56bc0ef-0f17-4d9e-afab-e75c43b8ee38 Co-authored-by: johnpierson <15744724+johnpierson@users.noreply.github.com> --- src/Libraries/CoreNodes/List.cs | 20 ++++++++++-- test/Libraries/CoreNodesTests/ListTests.cs | 36 ++++++++++++++++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/Libraries/CoreNodes/List.cs b/src/Libraries/CoreNodes/List.cs index 86627959c43..32c4cd27683 100644 --- a/src/Libraries/CoreNodes/List.cs +++ b/src/Libraries/CoreNodes/List.cs @@ -377,7 +377,15 @@ public static IList Sort(IEnumerable list) [IsVisibleInDynamoLibrary(true)] public static object MinimumItem(IEnumerable list) { - return list.Min(DoubleConverter); + var comparer = new ObjectComparer(); + object min = null; + foreach (var item in list) + { + if (item == null) continue; + if (min == null || comparer.Compare(item, min) < 0) + min = item; + } + return min; } /// @@ -389,7 +397,15 @@ public static object MinimumItem(IEnumerable list) [IsVisibleInDynamoLibrary(true)] public static object MaximumItem(IEnumerable list) { - return list.Max(DoubleConverter); + var comparer = new ObjectComparer(); + object max = null; + foreach (var item in list) + { + if (item == null) continue; + if (max == null || comparer.Compare(item, max) > 0) + max = item; + } + return max; } /// diff --git a/test/Libraries/CoreNodesTests/ListTests.cs b/test/Libraries/CoreNodesTests/ListTests.cs index a8c556e220e..f993b2a5d42 100644 --- a/test/Libraries/CoreNodesTests/ListTests.cs +++ b/test/Libraries/CoreNodesTests/ListTests.cs @@ -388,6 +388,42 @@ public static void ListMaximumValueMixed() Assert.AreEqual(66, List.MaximumItem(new List { 8.223, 4, 0.64, 66, 10.2 })); } + [Test] + [Category("UnitTests")] + public static void ListMaximumItemPreservesInt64Type() + { + var result = List.MaximumItem(new List { 8L, 4L, 0L, 66L, 10L }); + Assert.IsInstanceOf(result); + Assert.AreEqual(66L, result); + } + + [Test] + [Category("UnitTests")] + public static void ListMinimumItemPreservesInt64Type() + { + var result = List.MinimumItem(new List { 8L, 4L, 0L, 66L, 10L }); + Assert.IsInstanceOf(result); + Assert.AreEqual(0L, result); + } + + [Test] + [Category("UnitTests")] + public static void ListMaximumItemPreservesIntType() + { + var result = List.MaximumItem(new List { 8, 4, 0, 66, 10 }); + Assert.IsInstanceOf(result); + Assert.AreEqual(66, result); + } + + [Test] + [Category("UnitTests")] + public static void ListMinimumItemPreservesIntType() + { + var result = List.MinimumItem(new List { 8, 4, 0, 66, 10 }); + Assert.IsInstanceOf(result); + Assert.AreEqual(0, result); + } + [Test] [Category("UnitTests")] public static void FilterListByMask()