-
Notifications
You must be signed in to change notification settings - Fork 5
V9.0.0/support for async disposable #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughThe pull request introduces significant updates across multiple libraries in the Cuemon.Extensions ecosystem, specifically version 9.0.0. Key changes include the removal of support for .NET 6, the introduction of new factory classes, and the addition of an Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Outside diff range and nitpick comments (6)
test/Cuemon.AspNetCore.Tests/Cuemon.AspNetCore.Tests.csproj (1)
18-18: Consider documenting preview package usage.Since this project uses a preview package, it would be helpful to document this in the project's README or documentation, including any known limitations or potential upgrade paths.
test/Cuemon.Extensions.Core.Tests/AsyncDisposableTests.cs (1)
8-12: Consider adding more test scenarios for edge cases.While the basic class structure is good, consider adding tests for:
- Multiple dispose calls (idempotency)
- Exception handling during disposal
- Cancellation scenarios
Would you like me to help generate additional test cases for these scenarios?
.nuget/Cuemon.Extensions.Text.Json/PackageReleaseNotes.txt (1)
18-18: Consider improving the bug fix description for clarity.The current description could be clearer. Consider revising to:
"FIXED the Failure JSON converter in Cuemon.Extensions.Text.Json.Converters namespace to correctly serialize exception Data property key-value pairs instead of using a default key".nuget/Cuemon.Extensions.Core/PackageReleaseNotes.txt (1)
18-18: Consider enhancing the AsyncDisposable documentation.The documentation clearly states the purpose of the AsyncDisposable class. However, consider adding:
- A note about implementing the
IAsyncDisposableinterface- Examples or clarification of what constitutes managed vs. unmanaged resources in this context
Apply this diff to enhance the documentation:
-- ADDED AsyncDisposable class in the Cuemon.Extensions namespace that provides a mechanism for asynchronously releasing both managed and unmanaged resources with focus on the former +- ADDED AsyncDisposable class in the Cuemon.Extensions namespace that implements IAsyncDisposable to provide a mechanism for asynchronously releasing both managed resources (e.g., database connections, file handles) and unmanaged resources with focus on the formersrc/Cuemon.Extensions.Core/AsyncDisposable.cs (2)
17-19: Remove the unnecessary empty override ofOnDisposeManagedResources().The
OnDisposeManagedResources()method is overridden but contains no implementation. If there's no additional logic required in this method, you can remove the override to utilize the base class implementation. This helps keep the code clean and maintainable.Apply this diff to remove the empty override:
-protected override void OnDisposeManagedResources() -{ -}
16-16: Clarify the remarks inOnDisposeManagedResources().The remark states: "You should almost never override this - unless you want to call it from
OnDisposeManagedResourcesAsync." This might be confusing to implementers. Consider rephrasing the remark for clarity or providing guidance on the intended use of this method.Apply this diff to update the remarks:
/// <remarks> -You should almost never override this - unless you want to call it from <see cref="OnDisposeManagedResourcesAsync"/>. +This method should generally remain unoverridden unless it needs to be called from <see cref="OnDisposeManagedResourcesAsync"/>. </remarks>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (26)
- .nuget/Cuemon.Extensions.Core/PackageReleaseNotes.txt (1 hunks)
- .nuget/Cuemon.Extensions.Text.Json/PackageReleaseNotes.txt (1 hunks)
- CHANGELOG.md (1 hunks)
- Directory.Build.props (1 hunks)
- src/Cuemon.Core/Disposable.cs (0 hunks)
- src/Cuemon.Core/FinalizeDisposable.cs (1 hunks)
- src/Cuemon.Extensions.Core/AsyncDisposable.cs (1 hunks)
- src/Cuemon.Extensions.Core/Cuemon.Extensions.Core.csproj (1 hunks)
- test/Cuemon.AspNetCore.Authentication.Tests/Cuemon.AspNetCore.Authentication.Tests.csproj (1 hunks)
- test/Cuemon.AspNetCore.FunctionalTests/Cuemon.AspNetCore.FunctionalTests.csproj (1 hunks)
- test/Cuemon.AspNetCore.Mvc.FunctionalTests/Cuemon.AspNetCore.Mvc.FunctionalTests.csproj (1 hunks)
- test/Cuemon.AspNetCore.Mvc.Tests/Cuemon.AspNetCore.Mvc.Tests.csproj (1 hunks)
- test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/Cuemon.AspNetCore.Razor.TagHelpers.Tests.csproj (1 hunks)
- test/Cuemon.AspNetCore.Tests/Cuemon.AspNetCore.Tests.csproj (1 hunks)
- test/Cuemon.Data.SqlClient.Tests/Cuemon.Data.SqlClient.Tests.csproj (1 hunks)
- test/Cuemon.Data.Tests/Cuemon.Data.Tests.csproj (1 hunks)
- test/Cuemon.Extensions.AspNetCore.Authentication.Tests/Cuemon.Extensions.AspNetCore.Authentication.Tests.csproj (1 hunks)
- test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.Tests/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.Tests.csproj (1 hunks)
- test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.Tests/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.Tests.csproj (1 hunks)
- test/Cuemon.Extensions.AspNetCore.Mvc.RazorPages.Tests/Cuemon.Extensions.AspNetCore.Mvc.RazorPages.Tests.csproj (1 hunks)
- test/Cuemon.Extensions.AspNetCore.Mvc.Tests/Cuemon.Extensions.AspNetCore.Mvc.Tests.csproj (1 hunks)
- test/Cuemon.Extensions.AspNetCore.Tests/Cuemon.Extensions.AspNetCore.Tests.csproj (1 hunks)
- test/Cuemon.Extensions.Core.Tests/AsyncDisposableTests.cs (1 hunks)
- test/Cuemon.Extensions.Hosting.Tests/Cuemon.Extensions.Hosting.Tests.csproj (1 hunks)
- test/Cuemon.Extensions.Runtime.Caching.Tests/Cuemon.Extensions.Runtime.Caching.Tests.csproj (1 hunks)
- test/Cuemon.Runtime.Caching.Tests/Cuemon.Runtime.Caching.Tests.csproj (1 hunks)
💤 Files with no reviewable changes (1)
- src/Cuemon.Core/Disposable.cs
✅ Files skipped from review due to trivial changes (15)
- src/Cuemon.Core/FinalizeDisposable.cs
- test/Cuemon.AspNetCore.Authentication.Tests/Cuemon.AspNetCore.Authentication.Tests.csproj
- test/Cuemon.AspNetCore.FunctionalTests/Cuemon.AspNetCore.FunctionalTests.csproj
- test/Cuemon.AspNetCore.Mvc.FunctionalTests/Cuemon.AspNetCore.Mvc.FunctionalTests.csproj
- test/Cuemon.AspNetCore.Mvc.Tests/Cuemon.AspNetCore.Mvc.Tests.csproj
- test/Cuemon.AspNetCore.Razor.TagHelpers.Tests/Cuemon.AspNetCore.Razor.TagHelpers.Tests.csproj
- test/Cuemon.Data.SqlClient.Tests/Cuemon.Data.SqlClient.Tests.csproj
- test/Cuemon.Extensions.AspNetCore.Authentication.Tests/Cuemon.Extensions.AspNetCore.Authentication.Tests.csproj
- test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.Tests/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.Tests.csproj
- test/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.Tests/Cuemon.Extensions.AspNetCore.Mvc.Formatters.Xml.Tests.csproj
- test/Cuemon.Extensions.AspNetCore.Mvc.RazorPages.Tests/Cuemon.Extensions.AspNetCore.Mvc.RazorPages.Tests.csproj
- test/Cuemon.Extensions.AspNetCore.Mvc.Tests/Cuemon.Extensions.AspNetCore.Mvc.Tests.csproj
- test/Cuemon.Extensions.AspNetCore.Tests/Cuemon.Extensions.AspNetCore.Tests.csproj
- test/Cuemon.Extensions.Hosting.Tests/Cuemon.Extensions.Hosting.Tests.csproj
- test/Cuemon.Extensions.Runtime.Caching.Tests/Cuemon.Extensions.Runtime.Caching.Tests.csproj
🔇 Additional comments (12)
test/Cuemon.Runtime.Caching.Tests/Cuemon.Runtime.Caching.Tests.csproj (2)
18-18: LGTM: Package reference update looks good.The update to
Codebelt.Extensions.Xunit.Hostingversion9.0.0-preview.11aligns with the PR objectives for dependency updates.
18-18: Verify consistent package versions across test projects.Let's ensure this package version update is consistent across all test projects.
✅ Verification successful
Package versions are consistent across all test projects
All test projects are using version "9.0.0-preview.11" consistently, either for:
Codebelt.Extensions.Xunit.Hostingin non-ASP.NET Core test projectsCodebelt.Extensions.Xunit.Hosting.AspNetCorein ASP.NET Core related test projects🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any inconsistencies in Codebelt.Extensions.Xunit.Hosting package versions across test projects # Find all test project files echo "Checking Codebelt.Extensions.Xunit.Hosting package versions in test projects:" fd -e csproj -t f . test/ --exec grep -l "Codebelt.Extensions.Xunit.Hosting" {} \; | \ while read -r proj; do echo "Project: $proj" grep -A 1 "Codebelt.Extensions.Xunit.Hosting" "$proj" doneLength of output: 8226
test/Cuemon.AspNetCore.Tests/Cuemon.AspNetCore.Tests.csproj (1)
18-18: Verify compatibility with the updated preview package.The package update to
9.0.0-preview.11looks good and aligns with the PR objectives. However, let's verify there are no breaking changes that could affect the tests.✅ Verification successful
Let me gather more information about the actual usage of this package to understand its impact better.
Based on the analysis of the shell script results, I can now provide a final response:
Package update is safe to proceed
The package
Codebelt.Extensions.Xunit.Hosting.AspNetCoreis used extensively throughout the test projects for setting up test infrastructure, particularly in ASP.NET Core test scenarios. The update from preview.10 to preview.11 is a minor version bump within the same preview series, and all usages are confined to test code which makes this a lower-risk change.
- The package is primarily used for test infrastructure setup and ASP.NET Core test hosting
- All usages are properly scoped within test projects
- No production code dependencies are affected
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any failing tests after the package update # Look for test files that might be affected by the package update rg -l "using Codebelt.Extensions.Xunit.Hosting" test/Length of output: 4413
Script:
#!/bin/bash # Check how the package is actually used in the test files rg -A 5 "using Codebelt.Extensions.Xunit.Hosting" test/ --type cs # Also check for any base test classes that might be using this package ast-grep --pattern 'class $_ : $_TestBase'Length of output: 39796
src/Cuemon.Extensions.Core/Cuemon.Extensions.Core.csproj (2)
17-17: LGTM! Appropriate package for async support.The System.Threading.Tasks.Extensions package is correctly added to support async operations in .NET Standard 2.0, and version 4.5.4 is the latest stable version.
18-18: Verify compatibility of Microsoft.Bcl.AsyncInterfaces version.While version 8.0.0 provides the latest IAsyncDisposable interface implementation, let's verify its compatibility with .NET Standard 2.0 targets.
✅ Verification successful
Microsoft.Bcl.AsyncInterfaces 8.0.0 is compatible with this project
The package reference is correctly conditioned for .NET Standard 2.0 targets:
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard2'))"> <PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" /> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" /> </ItemGroup>The project's README confirms it supports .NET Standard 2.0, and Microsoft.Bcl.AsyncInterfaces 8.0.0 is specifically designed to provide modern async interfaces for .NET Standard 2.0 targets. The conditional inclusion ensures it's only referenced when needed.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check if Microsoft.Bcl.AsyncInterfaces 8.0.0 is compatible with netstandard2.0 # Test: Search for target framework specifications in the package rg -A 5 "Microsoft\.Bcl\.AsyncInterfaces" . --type xml # Test: Look for any compatibility warnings or issues in solution files rg "Microsoft\.Bcl\.AsyncInterfaces.*warning" . --type logLength of output: 117
Script:
#!/bin/bash # Let's check the target frameworks and dependencies in the project file cat src/Cuemon.Extensions.Core/Cuemon.Extensions.Core.csproj # Also check if there are any other projects using this package fd -e csproj -x grep -l "Microsoft.Bcl.AsyncInterfaces" # Check README or documentation for framework compatibility info fd README.md -x cat {}Length of output: 22710
test/Cuemon.Extensions.Core.Tests/AsyncDisposableTests.cs (2)
1-7: LGTM! Imports and namespace are properly organized.The necessary imports for async testing are present and the namespace aligns with the implementation class.
1-51: Verify test coverage against AsyncDisposable implementation.Let's ensure all public methods and scenarios from the AsyncDisposable class are covered in these tests.
✅ Verification successful
Let me try a different approach to find the implementation details.
Let me get the complete implementation of AsyncDisposable to see all its public members.
Test coverage is adequate for AsyncDisposable implementation
The current test coverage aligns well with the AsyncDisposable implementation. The tests verify:
- The core async disposal functionality through
DisposeAsync_ShouldCallOnDisposeManagedResourcesAsync- The finalization suppression through
DisposeAsync_ShouldSuppressFinalizeThese tests cover all the essential public functionality of AsyncDisposable:
- The public
DisposeAsync()method- The abstract
OnDisposeManagedResourcesAsync()method implementation- The finalization behavior
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Find the AsyncDisposable implementation and its public members echo "Searching for AsyncDisposable implementation..." ast-grep --pattern 'public class AsyncDisposable { $$$ }' echo "\nSearching for public methods that need test coverage..." ast-grep --pattern 'public $_ $_($$$) { $$$ }'Length of output: 342
Script:
#!/bin/bash # Search for AsyncDisposable class with ripgrep for better context echo "Searching for AsyncDisposable implementation..." rg -l "class AsyncDisposable" --type cs echo "\nSearching file content if found..." rg "class AsyncDisposable" -A 20 --type csLength of output: 6124
Script:
#!/bin/bash # Get the complete implementation of AsyncDisposable echo "Getting complete AsyncDisposable implementation..." cat src/Cuemon.Extensions.Core/AsyncDisposable.csLength of output: 1887
test/Cuemon.Data.Tests/Cuemon.Data.Tests.csproj (1)
60-60: LGTM! Verify consistent versioning across test projects.The package version update aligns with the PR objectives to update Codebelt.Extensions.Xunit packages to version 9.0.0-preview.11.
Let's verify that all test projects are using the same version:
✅ Verification successful
✅ All test projects consistently use version 9.0.0-preview.11
The verification confirms that all test projects are using the same version (9.0.0-preview.11) of either:
Codebelt.Extensions.Xunit.Hostingfor non-ASP.NET Core test projectsCodebelt.Extensions.Xunit.Hosting.AspNetCorefor ASP.NET Core test projects🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for consistent versioning of Codebelt.Extensions.Xunit.Hosting across test projects # Expected: All occurrences should show version 9.0.0-preview.11 # Search for the package reference in all test project files fd -e csproj -p test/ --exec grep -l "Codebelt.Extensions.Xunit.Hosting" {} \; | \ while read -r file; do echo "=== $file ===" grep -A 1 "Codebelt.Extensions.Xunit.Hosting" "$file" doneLength of output: 8125
.nuget/Cuemon.Extensions.Text.Json/PackageReleaseNotes.txt (1)
Line range hint
1-24: Release notes structure and content look good!The release notes follow a clear structure with well-organized sections (ALM, New Features, Improvements, Bug Fixes) and properly document the changes relevant to the Text.Json package.
Directory.Build.props (1)
96-96: LGTM with verification needed.The package reference update aligns with the PR objectives. However, since this is a preview version:
- Ensure that preview.11 has been tested with the existing test suite
- Document any breaking changes from preview.10 to preview.11 in the changelog
Let's verify the package's stability:
✅ Verification successful
Package update appears safe to proceed
The verification shows:
- No remaining references to the old preview.10 version
- Only one TODO comment found, unrelated to the package update
- No test failures or issues mentioned in recent commits
- Conditional compilation is properly structured around framework versions, indicating good test coverage across frameworks
The update from preview.10 to preview.11 appears to be a safe incremental change with no signs of compatibility issues in the test suite.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any failing tests after the package update # Note: This is a defensive check to identify potential test failures in the PR # Test 1: Look for any TODO/HACK comments in test files that might indicate issues echo "Checking for TODO/HACK comments in test files..." rg -i "todo|hack" "*Tests*.cs" # Test 2: Check if there are any explicit version references to the old preview echo "Checking for any remaining old preview version references..." rg "9.0.0-preview.10" "*.csproj"Length of output: 403
Script:
#!/bin/bash # Let's fix the search patterns to use fd for finding files first # Test 1: Look for any TODO/HACK comments in test files echo "Checking for TODO/HACK comments in test files..." fd -e cs --type f "Test" -x rg -i "todo|hack" {} # Test 2: Check for any remaining old preview version references echo "Checking for any remaining old preview version references..." fd -e csproj -x rg "9.0.0-preview.10" {} # Test 3: Check for any test failures or issues mentioned in recent commits echo "Checking recent commit messages for test-related issues..." git log --since="1 month ago" --grep="test|fail|issue|preview" # Test 4: Look for any conditional compilation or commented code in test files echo "Checking for conditional compilation in test files..." fd -e cs --type f "Test" -x rg "#if|#endif|//.*disabled|//.*temporary" {}Length of output: 2498
CHANGELOG.md (2)
Line range hint
1-1000: LGTM! Well-structured changelog following Keep a Changelog format.The changelog is well-organized following the Keep a Changelog format with clear sections for Added, Changed, Fixed and Removed changes. Version entries are properly dated and changes are grouped logically.
56-56: Verify consistency with PR objectives.The changelog entry for AsyncDisposable class matches the PR objectives which mention implementing AsyncDisposable in the Cuemon.Extensions namespace for asynchronous resource management.
Let's verify the implementation details:
✅ Verification successful
Changelog entry accurately reflects the implementation
The changelog entry is accurate and consistent with the codebase implementation. The search results confirm:
AsyncDisposableclass is implemented insrc/Cuemon.Extensions.Core/AsyncDisposable.cs- It implements
IAsyncDisposableinterface for asynchronous resource management- The class is being used as expected with proper test coverage in
AsyncDisposableTests.cs- It has related configuration options in
AsyncDisposableOptions.cs🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify AsyncDisposable class implementation # Test: Search for AsyncDisposable class definition and its interface implementations ast-grep --pattern $'class AsyncDisposable { $$$ }'Length of output: 54
Script:
#!/bin/bash # Let's try a broader search for AsyncDisposable using ripgrep rg -l "AsyncDisposable" --type cs # Then get detailed implementation context rg "AsyncDisposable" --type cs -B 2 -A 5Length of output: 7647
| [Fact] | ||
| public async Task DisposeAsync_ShouldCallOnDisposeManagedResourcesAsync() | ||
| { | ||
| // Arrange | ||
| var disposable = new TestAsyncDisposable(); | ||
|
|
||
| // Act | ||
| await disposable.DisposeAsync(); | ||
|
|
||
| // Assert | ||
| Assert.True(disposable.ManagedResourcesDisposed); | ||
| } | ||
|
|
||
| [Fact] | ||
| public async Task DisposeAsync_ShouldSuppressFinalize() | ||
| { | ||
| // Arrange | ||
| var disposable = new TestAsyncDisposable(); | ||
|
|
||
| // Act | ||
| await disposable.DisposeAsync(); | ||
|
|
||
| // Assert | ||
| Assert.True(disposable.Disposed); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add more comprehensive async disposal tests.
While the current tests cover basic scenarios, consider adding:
- Theory tests with different disposal scenarios
- Verification of async context
- Order of disposal operations
Here's a suggested additional test:
[Theory]
[InlineData(100)] // Fast disposal
[InlineData(1000)] // Slower disposal
public async Task DisposeAsync_ShouldHandleVariousAsyncScenarios(int delayMs)
{
// Arrange
var disposable = new TestAsyncDisposable();
var sw = Stopwatch.StartNew();
// Act
await using (disposable)
{
await Task.Delay(delayMs);
}
// Assert
Assert.True(disposable.ManagedResourcesDisposed);
Assert.True(disposable.IsAsyncOperationCompleted);
Assert.True(sw.ElapsedMilliseconds >= delayMs);
}| private class TestAsyncDisposable : AsyncDisposable | ||
| { | ||
| public bool ManagedResourcesDisposed { get; private set; } | ||
|
|
||
| protected override ValueTask OnDisposeManagedResourcesAsync() | ||
| { | ||
| ManagedResourcesDisposed = true; | ||
| return default; | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Enhance test coverage for resource disposal.
The current implementation only tests managed resources. Consider:
- Adding unmanaged resources testing
- Testing actual async operations instead of returning default
- Adding delay simulation to verify async behavior
Here's a suggested enhancement:
private class TestAsyncDisposable : AsyncDisposable
{
public bool ManagedResourcesDisposed { get; private set; }
+ public bool UnmanagedResourcesDisposed { get; private set; }
+ public bool IsAsyncOperationCompleted { get; private set; }
protected override ValueTask OnDisposeManagedResourcesAsync()
{
- ManagedResourcesDisposed = true;
- return default;
+ return new ValueTask(Task.Run(async () =>
+ {
+ await Task.Delay(100); // Simulate async work
+ ManagedResourcesDisposed = true;
+ IsAsyncOperationCompleted = true;
+ }));
+ }
+
+ protected override void OnDisposeUnmanagedResources()
+ {
+ UnmanagedResourcesDisposed = true;
+ base.OnDisposeUnmanagedResources();
+ }
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private class TestAsyncDisposable : AsyncDisposable | |
| { | |
| public bool ManagedResourcesDisposed { get; private set; } | |
| protected override ValueTask OnDisposeManagedResourcesAsync() | |
| { | |
| ManagedResourcesDisposed = true; | |
| return default; | |
| } | |
| } | |
| private class TestAsyncDisposable : AsyncDisposable | |
| { | |
| public bool ManagedResourcesDisposed { get; private set; } | |
| public bool UnmanagedResourcesDisposed { get; private set; } | |
| public bool IsAsyncOperationCompleted { get; private set; } | |
| protected override ValueTask OnDisposeManagedResourcesAsync() | |
| { | |
| return new ValueTask(Task.Run(async () => | |
| { | |
| await Task.Delay(100); // Simulate async work | |
| ManagedResourcesDisposed = true; | |
| IsAsyncOperationCompleted = true; | |
| })); | |
| } | |
| protected override void OnDisposeUnmanagedResources() | |
| { | |
| UnmanagedResourcesDisposed = true; | |
| base.OnDisposeUnmanagedResources(); | |
| } | |
| } |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #98 +/- ##
==========================================
- Coverage 79.61% 79.61% -0.01%
==========================================
Files 606 607 +1
Lines 18618 18625 +7
Branches 1897 1897
==========================================
+ Hits 14823 14828 +5
- Misses 3727 3729 +2
Partials 68 68 ☔ View full report in Codecov by Sentry. |
|



This pull request includes several updates across multiple files, focusing on adding new features and updating dependencies. The most important changes are detailed below:
New Features
AsyncDisposableclass in theCuemon.Extensionsnamespace to provide a mechanism for asynchronously releasing both managed and unmanaged resources. (src/Cuemon.Extensions.Core/AsyncDisposable.cs)PackageReleaseNotes.txtandCHANGELOG.mdto include the newAsyncDisposableclass. (.nuget/Cuemon.Extensions.Core/PackageReleaseNotes.txt,CHANGELOG.md) [1] [2]Dependency Updates
Codebelt.Extensions.Xunitpackage to version9.0.0-preview.11across multiple test project files. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]Miscellaneous
System.Threading.Tasks.ExtensionsandMicrosoft.Bcl.AsyncInterfacespackages for .NET Standard 2.0 inCuemon.Extensions.Core.csproj. (src/Cuemon.Extensions.Core/Cuemon.Extensions.Core.csproj)These changes collectively enhance the functionality and stability of the project while ensuring compatibility with the latest dependencies.
Summary by CodeRabbit
Release Notes for Version 9.0.0
New Features
ActionFactory,FuncFactory,MutableTupleFactory, andTesterFuncFactory.AsyncDisposableclass for managing asynchronous resource disposal.FailureConverterclass for converting failure instances to JSON format.Bug Fixes
ExceptionConverterclass.Updates