This is an automated email from the ASF dual-hosted git repository.

ptupitsyn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new e2d538bbfa1 IGNITE-24620 .NET: Use standard LINQ exceptions in 
First/Single operations (#7903)
e2d538bbfa1 is described below

commit e2d538bbfa1fee761c244f63e7f18ec43f7502f9
Author: Reza Taroosheh <[email protected]>
AuthorDate: Tue Mar 31 11:19:19 2026 +0200

    IGNITE-24620 .NET: Use standard LINQ exceptions in First/Single operations 
(#7903)
---
 .../Apache.Ignite.Tests/Linq/LinqTests.AsyncMaterialization.cs    | 8 ++++----
 .../dotnet/Apache.Ignite.Tests/Linq/LinqTests.MemberInit.cs       | 3 +--
 modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.cs    | 3 +--
 .../dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs     | 4 ++--
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.AsyncMaterialization.cs
 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.AsyncMaterialization.cs
index 205a1de0e06..7c5498d4d9f 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.AsyncMaterialization.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.AsyncMaterialization.cs
@@ -107,7 +107,7 @@ public partial class LinqTests
         Assert.AreEqual(6L, (await query.FirstAsync(x => x.Key > 5)).Key);
 
         var ex = Assert.ThrowsAsync<InvalidOperationException>(() => 
query.FirstAsync(x => x.Key > 1000));
-        StringAssert.StartsWith("ResultSet is empty: ", ex!.Message);
+        Assert.AreEqual("Sequence contains no elements", ex!.Message);
     }
 
     [Test]
@@ -129,10 +129,10 @@ public partial class LinqTests
         Assert.AreEqual(6L, (await query.SingleAsync(x => x.Key == 6)).Key);
 
         var ex = Assert.ThrowsAsync<InvalidOperationException>(() => 
query.SingleAsync());
-        StringAssert.StartsWith("ResultSet is expected to have one row, but 
has more: ", ex!.Message);
+        Assert.AreEqual("Sequence contains more than one matching element", 
ex!.Message);
 
         var ex2 = Assert.ThrowsAsync<InvalidOperationException>(() => 
query.SingleAsync(x => x.Key > 1000));
-        StringAssert.StartsWith("ResultSet is empty: ", ex2!.Message);
+        Assert.AreEqual("Sequence contains no elements", ex2!.Message);
     }
 
     [Test]
@@ -145,7 +145,7 @@ public partial class LinqTests
         Assert.IsNull(await query.SingleOrDefaultAsync(x => x.Key > 1000));
 
         var ex = Assert.ThrowsAsync<InvalidOperationException>(() => 
query.SingleOrDefaultAsync());
-        StringAssert.StartsWith("ResultSet is expected to have one row, but 
has more: ", ex!.Message);
+        Assert.AreEqual("Sequence contains more than one matching element", 
ex!.Message);
     }
 
     [Test]
diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.MemberInit.cs 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.MemberInit.cs
index 667c86481a7..9de0c596227 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.MemberInit.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.MemberInit.cs
@@ -125,8 +125,7 @@ public partial class LinqTests
                 .Select(x => new CustomProjectionCtorAndInit(x.Key) { RefField 
= x.Val })
                 .Single());
 
-        const string expected = "ResultSet is expected to have one row, but 
has more: " +
-                                "select _T0.KEY, _T0.VAL as REFFIELD from 
PUBLIC.TBL1 as _T0 limit 2";
+        const string expected = "Sequence contains more than one matching 
element";
 
         Assert.AreEqual(expected, ex!.Message);
 
diff --git a/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.cs 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.cs
index 2d447614987..97c67590da7 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/Linq/LinqTests.cs
@@ -168,8 +168,7 @@ public partial class LinqTests : IgniteTestsBase
             .Select(x => x.Val)
             .Single());
 
-        const string expected = "ResultSet is expected to have one row, but 
has more: " +
-                                "select _T0.VAL from PUBLIC.TBL1 as _T0 limit 
2";
+        const string expected = "Sequence contains more than one matching 
element";
 
         Assert.AreEqual(expected, ex!.Message);
     }
diff --git 
a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs 
b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs
index 378bebcae9d..53a67f856f8 100644
--- 
a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs
+++ 
b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/IgniteQueryExecutor.cs
@@ -168,7 +168,7 @@ internal sealed class IgniteQueryExecutor : IQueryExecutor
             if (count > 0)
             {
                 throw new InvalidOperationException(
-                    "ResultSet is expected to have one row, but has more: " + 
GetQueryData(queryModel).QueryText);
+                    "Sequence contains more than one matching element");
             }
 
             res = row;
@@ -177,7 +177,7 @@ internal sealed class IgniteQueryExecutor : IQueryExecutor
 
         if (count == 0 && options != ExecutionOptions.ReturnDefaultWhenEmpty)
         {
-            throw new InvalidOperationException("ResultSet is empty: " + 
GetQueryData(queryModel).QueryText);
+            throw new InvalidOperationException("Sequence contains no 
elements");
         }
 
         return res;

Reply via email to