From ab42a38fd645f91c524d2006dcc6acb984bdd1e0 Mon Sep 17 00:00:00 2001 From: Michael Thyregod <2386496+michaelthyregod@users.noreply.github.com> Date: Sun, 8 Nov 2026 16:49:41 +0100 Subject: [PATCH 1/2] Read the diff:match result without the IHtmlCollection indexer From AngleSharp 1.3.1 the .NET 8 build of IHtmlCollection takes its indexer from IReadOnlyList, so the netstandard2.0 build of this library threw MissingMethodException for diff:match on .NET 8 and later. --- .../Strategies/ElementStrategies/CssSelectorElementMatcher.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AngleSharp.Diffing/Strategies/ElementStrategies/CssSelectorElementMatcher.cs b/src/AngleSharp.Diffing/Strategies/ElementStrategies/CssSelectorElementMatcher.cs index a900b62..bdc985f 100644 --- a/src/AngleSharp.Diffing/Strategies/ElementStrategies/CssSelectorElementMatcher.cs +++ b/src/AngleSharp.Diffing/Strategies/ElementStrategies/CssSelectorElementMatcher.cs @@ -43,7 +43,7 @@ private static bool TryGetTestNode(IDiffContext context, string cssSelector, [No testNode = searchResult.Length switch { 0 => null, - 1 => searchResult[0], + 1 => searchResult.First(), _ => throw new DiffMatchSelectorReturnedTooManyResultsException($@"The CSS selector ""{cssSelector}"" returned {searchResult.Length} matches from the test node tree. No more than one is allowed.") }; From 387c5e65ba97c2cd4fd7565bd6efcd0f9579d025 Mon Sep 17 00:00:00 2001 From: Michael Thyregod <2386496+michaelthyregod@users.noreply.github.com> Date: Sun, 8 Nov 2026 16:49:41 +0100 Subject: [PATCH 2/2] Run the tests on AngleSharp 1.10.0 The library keeps its minimum; the tests run on a version whose .NET 8 build differs from the netstandard2.0 one, which catches the diff:match break. --- src/AngleSharp.Diffing.Tests/AngleSharp.DiffingTests.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/AngleSharp.Diffing.Tests/AngleSharp.DiffingTests.csproj b/src/AngleSharp.Diffing.Tests/AngleSharp.DiffingTests.csproj index ec15b72..e1f8a91 100644 --- a/src/AngleSharp.Diffing.Tests/AngleSharp.DiffingTests.csproj +++ b/src/AngleSharp.Diffing.Tests/AngleSharp.DiffingTests.csproj @@ -10,6 +10,9 @@ + + all