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 819fe8a02c IGNITE-18626 .NET: Fix nullable result handling in LINQ 
(#1571)
819fe8a02c is described below

commit 819fe8a02ca892711244d20bf6162cf784f45cad
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Wed Jan 25 09:41:31 2023 +0200

    IGNITE-18626 .NET: Fix nullable result handling in LINQ (#1571)
    
    Fix `System.AccessViolationException` when reading nullable value types in 
LINQ.
    
    No new tests: existing tests cover the use case, but the bug could only be 
reproduced in Release mode on Linux, or in any mode without a debugger on 
Windows.
---
 .../platforms/dotnet/Apache.Ignite.Tests/Buffers/ByteArrayPoolTests.cs  | 2 ++
 modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/modules/platforms/dotnet/Apache.Ignite.Tests/Buffers/ByteArrayPoolTests.cs 
b/modules/platforms/dotnet/Apache.Ignite.Tests/Buffers/ByteArrayPoolTests.cs
index 11dde5224f..ee3911cbe0 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Tests/Buffers/ByteArrayPoolTests.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Tests/Buffers/ByteArrayPoolTests.cs
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+#if DEBUG
 namespace Apache.Ignite.Tests.Buffers
 {
     using System;
@@ -37,3 +38,4 @@ namespace Apache.Ignite.Tests.Buffers
         }
     }
 }
+#endif
diff --git 
a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs 
b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs
index 0e4241fb8f..05c2ec03f1 100644
--- a/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs
+++ b/modules/platforms/dotnet/Apache.Ignite/Internal/Linq/ResultSelector.cs
@@ -245,7 +245,7 @@ internal static class ResultSelector
                         // Create nullable with default non-zero value.
                         var local = il.DeclareLocal(underlyingType);
                         il.Emit(OpCodes.Ldloca_S, local);
-                        il.Emit(OpCodes.Initobj, targetType); // Load default 
value into local.
+                        il.Emit(OpCodes.Initobj, underlyingType); // Load 
default value into local.
                         il.Emit(OpCodes.Ldloc, local); // Load local value 
onto stack for constructor call.
                         il.Emit(OpCodes.Newobj, 
targetType.GetConstructor(new[] { underlyingType })!);
                     }

Reply via email to