From 7f95bab93d7214ecdc7a696cf5649b4bcccea046 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 2 Jan 2026 13:58:34 +0000 Subject: [PATCH 1/5] Initial plan From 53df339c32ef385c9e1fbe80de478c1c8f454bee Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 2 Jan 2026 14:31:26 +0000 Subject: [PATCH 2/5] Initial plan: Fix xUnit1031 warnings for blocking task operations Co-authored-by: jeanlrnt <63308635+jeanlrnt@users.noreply.github.com> --- test-output.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test-output.txt diff --git a/test-output.txt b/test-output.txt new file mode 100644 index 0000000..6922a16 --- /dev/null +++ b/test-output.txt @@ -0,0 +1,7 @@ +Test run for /home/runner/work/MiniCron.Core/MiniCron.Core/src/MiniCron.Tests/bin/Debug/net10.0/MiniCron.Tests.dll (.NETCoreApp,Version=v10.0) +VSTest version 18.0.1 (x64) + +Starting test execution, please wait... +A total of 1 test files matched the specified pattern. + +Passed! - Failed: 0, Passed: 155, Skipped: 0, Total: 155, Duration: 3 s - MiniCron.Tests.dll (net10.0) From f9b212adf88fd9d356bcaf2c70009ebc0d365f1a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 2 Jan 2026 14:33:22 +0000 Subject: [PATCH 3/5] fix(test): Replace blocking Task operations with ManualResetEventSlim - MiniCronTests.EventInvocationOutsideLock.cs Co-authored-by: jeanlrnt <63308635+jeanlrnt@users.noreply.github.com> --- ...MiniCronTests.EventInvocationOutsideLock.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/MiniCron.Tests/MiniCronTests.EventInvocationOutsideLock.cs b/src/MiniCron.Tests/MiniCronTests.EventInvocationOutsideLock.cs index c398b68..4f2a1a2 100644 --- a/src/MiniCron.Tests/MiniCronTests.EventInvocationOutsideLock.cs +++ b/src/MiniCron.Tests/MiniCronTests.EventInvocationOutsideLock.cs @@ -13,7 +13,7 @@ public async Task JobRegistry_JobAdded_InvokedOutsideLock_AllowsConcurrentReads( { var registry = new JobRegistry(); var eventHandlerStarted = new TaskCompletionSource(); - var eventHandlerCanComplete = new TaskCompletionSource(); + var eventHandlerCanComplete = new ManualResetEventSlim(false); var getJobsCompleted = new TaskCompletionSource(); // Subscribe to JobAdded with a long-running handler @@ -22,7 +22,7 @@ public async Task JobRegistry_JobAdded_InvokedOutsideLock_AllowsConcurrentReads( eventHandlerStarted.SetResult(true); // Simulate a slow event handler (e.g., logging to database) // Block synchronously until signaled - eventHandlerCanComplete.Task.GetAwaiter().GetResult(); + eventHandlerCanComplete.Wait(); }; // Schedule a job (which will trigger JobAdded event) @@ -47,7 +47,7 @@ public async Task JobRegistry_JobAdded_InvokedOutsideLock_AllowsConcurrentReads( await Task.WhenAll(getJobsCompleted.Task.WaitAsync(TimeSpan.FromSeconds(5)), getJobsTask); // Now allow event handler to complete - eventHandlerCanComplete.SetResult(true); + eventHandlerCanComplete.Set(); await scheduleTask; } @@ -61,14 +61,14 @@ public async Task JobRegistry_JobRemoved_InvokedOutsideLock_AllowsConcurrentRead var jobId = registry.ScheduleJob("* * * * *", () => { }); var eventHandlerStarted = new TaskCompletionSource(); - var eventHandlerCanComplete = new TaskCompletionSource(); + var eventHandlerCanComplete = new ManualResetEventSlim(false); var getJobsCompleted = new TaskCompletionSource(); // Subscribe to JobRemoved with a long-running handler registry.JobRemoved += (_, _) => { eventHandlerStarted.SetResult(true); - eventHandlerCanComplete.Task.GetAwaiter().GetResult(); + eventHandlerCanComplete.Wait(); }; // Remove the job (which will trigger JobRemoved event) @@ -92,7 +92,7 @@ public async Task JobRegistry_JobRemoved_InvokedOutsideLock_AllowsConcurrentRead await Task.WhenAll(getJobsCompleted.Task.WaitAsync(TimeSpan.FromSeconds(5)), getJobsTask); // Allow event handler to complete - eventHandlerCanComplete.SetResult(true); + eventHandlerCanComplete.Set(); await removeTask; } @@ -106,14 +106,14 @@ public async Task JobRegistry_JobUpdated_InvokedOutsideLock_AllowsConcurrentRead var jobId = registry.ScheduleJob("* * * * *", () => { }); var eventHandlerStarted = new TaskCompletionSource(); - var eventHandlerCanComplete = new TaskCompletionSource(); + var eventHandlerCanComplete = new ManualResetEventSlim(false); var getJobsCompleted = new TaskCompletionSource(); // Subscribe to JobUpdated with a long-running handler registry.JobUpdated += (_, _) => { eventHandlerStarted.SetResult(true); - eventHandlerCanComplete.Task.GetAwaiter().GetResult(); + eventHandlerCanComplete.Wait(); }; // Update the job schedule (which will trigger JobUpdated event) @@ -138,7 +138,7 @@ public async Task JobRegistry_JobUpdated_InvokedOutsideLock_AllowsConcurrentRead await Task.WhenAll(getJobsCompleted.Task.WaitAsync(TimeSpan.FromSeconds(5)), getJobsTask); // Allow event handler to complete - eventHandlerCanComplete.SetResult(true); + eventHandlerCanComplete.Set(); await updateTask; } From 01bbd3b1590914991ca8c1af33247035c44f6466 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 2 Jan 2026 14:34:13 +0000 Subject: [PATCH 4/5] chore: Remove accidentally committed test-output.txt file Co-authored-by: jeanlrnt <63308635+jeanlrnt@users.noreply.github.com> --- test-output.txt | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 test-output.txt diff --git a/test-output.txt b/test-output.txt deleted file mode 100644 index 6922a16..0000000 --- a/test-output.txt +++ /dev/null @@ -1,7 +0,0 @@ -Test run for /home/runner/work/MiniCron.Core/MiniCron.Core/src/MiniCron.Tests/bin/Debug/net10.0/MiniCron.Tests.dll (.NETCoreApp,Version=v10.0) -VSTest version 18.0.1 (x64) - -Starting test execution, please wait... -A total of 1 test files matched the specified pattern. - -Passed! - Failed: 0, Passed: 155, Skipped: 0, Total: 155, Duration: 3 s - MiniCron.Tests.dll (net10.0) From 83d3fb4af816bc2caf1566e8d42ecba369d863aa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 3 Jan 2026 13:28:55 +0000 Subject: [PATCH 5/5] fix(test): Add using statement for ManualResetEventSlim disposal - MiniCronTests.EventInvocationOutsideLock.cs Co-authored-by: jeanlrnt <63308635+jeanlrnt@users.noreply.github.com> --- .../MiniCronTests.EventInvocationOutsideLock.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MiniCron.Tests/MiniCronTests.EventInvocationOutsideLock.cs b/src/MiniCron.Tests/MiniCronTests.EventInvocationOutsideLock.cs index 4f2a1a2..6086fa1 100644 --- a/src/MiniCron.Tests/MiniCronTests.EventInvocationOutsideLock.cs +++ b/src/MiniCron.Tests/MiniCronTests.EventInvocationOutsideLock.cs @@ -13,7 +13,7 @@ public async Task JobRegistry_JobAdded_InvokedOutsideLock_AllowsConcurrentReads( { var registry = new JobRegistry(); var eventHandlerStarted = new TaskCompletionSource(); - var eventHandlerCanComplete = new ManualResetEventSlim(false); + using var eventHandlerCanComplete = new ManualResetEventSlim(false); var getJobsCompleted = new TaskCompletionSource(); // Subscribe to JobAdded with a long-running handler @@ -61,7 +61,7 @@ public async Task JobRegistry_JobRemoved_InvokedOutsideLock_AllowsConcurrentRead var jobId = registry.ScheduleJob("* * * * *", () => { }); var eventHandlerStarted = new TaskCompletionSource(); - var eventHandlerCanComplete = new ManualResetEventSlim(false); + using var eventHandlerCanComplete = new ManualResetEventSlim(false); var getJobsCompleted = new TaskCompletionSource(); // Subscribe to JobRemoved with a long-running handler @@ -106,7 +106,7 @@ public async Task JobRegistry_JobUpdated_InvokedOutsideLock_AllowsConcurrentRead var jobId = registry.ScheduleJob("* * * * *", () => { }); var eventHandlerStarted = new TaskCompletionSource(); - var eventHandlerCanComplete = new ManualResetEventSlim(false); + using var eventHandlerCanComplete = new ManualResetEventSlim(false); var getJobsCompleted = new TaskCompletionSource(); // Subscribe to JobUpdated with a long-running handler