Skip to content

Commit

Permalink
Use LibraryImport only for NET8 and greater
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmorato committed Dec 18, 2024
1 parent 2f35f59 commit 8fb010b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Native/CSharpCDRImplTemplate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@

public static partial class <%TYPE%>DataWriterNative
{
#if NET7_0_OR_GREATER
#if NET8_0_OR_GREATER
[SuppressUnmanagedCodeSecurity]
[LibraryImport(<%TYPE%>.API_DLL, EntryPoint = "<%SCOPED_METHOD%>DataWriter_Narrow")]
[UnmanagedCallConv(CallConvs = new[] { typeof(System.Runtime.CompilerServices.CallConvSuppressGCTransition) })]
Expand Down
36 changes: 18 additions & 18 deletions Tests/OpenDDSharp.UnitTest/DataReaderCDRTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1856,29 +1856,29 @@ public void TestReadNextInstance()
// Write two samples of three different instances
for (short i = 1; i <= 3; i++)
{
// evt.Reset();
// TestHelper.CreateWaitSetThread(evt, statusCondition);
evt.Reset();
TestHelper.CreateWaitSetThread(evt, statusCondition);

result = dataWriter.Write(new TestInclude { Id = i.ToString() });
Assert.AreEqual(ReturnCode.Ok, result);
Thread.Sleep(1_000);

// result = dataWriter.WaitForAcknowledgments(new Duration { Seconds = 5 });
// Assert.AreEqual(ReturnCode.Ok, result);
//
// Assert.IsTrue(evt.Wait(1_500));
//
// evt.Reset();
// TestHelper.CreateWaitSetThread(evt, statusCondition);

// result = dataWriter.Write(new TestInclude { Id = i.ToString(), ShortField = i });
// Assert.AreEqual(ReturnCode.Ok, result);
// Thread.Sleep(1_000);

// result = dataWriter.WaitForAcknowledgments(new Duration { Seconds = 5 });
// Assert.AreEqual(ReturnCode.Ok, result);
//
// Assert.IsTrue(evt.Wait(1_500));
result = dataWriter.WaitForAcknowledgments(new Duration { Seconds = 5 });
Assert.AreEqual(ReturnCode.Ok, result);

Assert.IsTrue(evt.Wait(1_500));

evt.Reset();
TestHelper.CreateWaitSetThread(evt, statusCondition);

result = dataWriter.Write(new TestInclude { Id = i.ToString(), ShortField = i });
Assert.AreEqual(ReturnCode.Ok, result);
// Thread.Sleep(1_000);

result = dataWriter.WaitForAcknowledgments(new Duration { Seconds = 5 });
Assert.AreEqual(ReturnCode.Ok, result);

Assert.IsTrue(evt.Wait(1_500));
}

// Read next instance with the simplest overload
Expand Down

0 comments on commit 8fb010b

Please sign in to comment.