From f01eb2d5d4d3b683b2be9a49c8b0dd039e925376 Mon Sep 17 00:00:00 2001 From: Lucas Viana Date: Sun, 3 Dec 2023 00:52:32 -0300 Subject: [PATCH] fix: add logs to debug unit test issues --- YDotNet/Infrastructure/MemoryReader.cs | 4 ++++ YDotNet/Native/UndoManager/Events/UndoEventNative.cs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/YDotNet/Infrastructure/MemoryReader.cs b/YDotNet/Infrastructure/MemoryReader.cs index 862e3b64..ef7a2099 100644 --- a/YDotNet/Infrastructure/MemoryReader.cs +++ b/YDotNet/Infrastructure/MemoryReader.cs @@ -12,8 +12,12 @@ internal static byte[] ReadBytes(nint handle, uint length) { var data = new byte[length]; + Console.WriteLine($"(1) Data: {data == null} | {data.Length} | Handle={handle} | Length={length}"); + Marshal.Copy(handle, data, startIndex: 0, (int) length); + Console.WriteLine("(2) Copied to data"); + return data; } diff --git a/YDotNet/Native/UndoManager/Events/UndoEventNative.cs b/YDotNet/Native/UndoManager/Events/UndoEventNative.cs index 396af51c..fa83b781 100644 --- a/YDotNet/Native/UndoManager/Events/UndoEventNative.cs +++ b/YDotNet/Native/UndoManager/Events/UndoEventNative.cs @@ -22,6 +22,9 @@ internal struct UndoEventNative return null; } + Console.WriteLine($"OriginHandle: {OriginHandle}"); + Console.WriteLine($"OriginLength: {OriginLength}"); + return MemoryReader.ReadBytes(OriginHandle, OriginLength); } }