V10.6.0/new features - #168
Conversation
Introduces TargetFrameworkMoniker, a new static utility class in Cuemon.Reflection that parses and resolves short target framework monikers (such as net10.0, net9.0, netstandard2.0) from framework names, assemblies, paths, and the current application context. Includes comprehensive API documentation and unit test coverage.
Documents the new TargetFrameworkMoniker class introduction in the Cuemon.Core v10.6.0 package release, including availability across .NET 10, .NET 9, and .NET Standard 2.0.
Removes outdated analyzer suppression rules: CA1200 (cref tags with prefix) and IDE0330 (System.Threading.Lock). These exclusions are no longer needed as the codebase has moved past the constraints that originally required them.
Add portable, case-insensitive file provider implementation with support for .NET 10, .NET 9, and .NET Standard 2.0. Includes comprehensive unit tests and project scaffolding for the new extension library.
Add NuGet package README and release notes for the new Cuemon.Extensions.FileProviders.Physical library.
Update Codebelt.Extensions packages to v11.2.0 and add Microsoft.Extensions.FileProviders.Physical v9.0.18 and v10.0.10 for net9 and net10+netstandard2 target frameworks respectively.
Add performance benchmarks for the Awaiter class measuring fast-path direct await, immediate success, and retry failure scenarios using BenchmarkDotNet.
Added detailed guidance for fast feedback loop testing with affected projects only (avoiding full 40+ project suite). Clarified docker-compose setup requirement for full test suite since Cuemon.Data.SqlClient.Tests depends on SQL Server. Structured test commands by development vs. comprehensive validation workflows.
Include Cuemon.Extensions.FileProviders.Physical in the documentation generation pipeline.
Performance: Add IsEnabled guards to logging calls in ServerTimingFilter and ServerTimingMiddleware to avoid parameter allocation when log level is disabled. Code quality: Suppress unused return value warnings with discard operator in TargetFrameworkMoniker. TFM compatibility: Use newer WriteAsync/AppendLine overloads for net9.0+ while preserving netstandard2.0 compatibility. Pattern improvement: Enhance async pattern matching for line reading in DsvDataReader.
Convert XML documentation cref attributes from old-style T:Type[] format to cleaner, more readable patterns. For example: T:byte[] becomes 'byte array', T:IConvertible[] becomes 'IConvertible array', and T:System.Object becomes 'System.Object'. This improves readability and consistency of API documentation across 75 source files throughout the Cuemon package family.
Refined and improved code examples across 43 API type documentation pages to better demonstrate real-world usage patterns and output verification. Added complete documentation for the new Cuemon.Extensions.FileProviders namespace including the PortablePhysicalFileProvider type with practical examples showing case-insensitive file resolution, directory enumeration, and change notifications.
Updated XML documentation in four files to use correct cref syntax for the parameterless Disposable.Dispose() method. Changed from 'Disposable.Dispose' to 'Disposable.Dispose()' to match IntelliSense and documentation rendering requirements.
Enhanced the retry loop in Awaiter to properly handle cancellation tokens. Added explicit OperationCanceledException re-throw to ensure cancellation requests are propagated correctly. Task.Delay now accepts the CancellationToken parameter to honor cancellation during retry delays.
Reorganized benchmark structure to align with source code layout. Moved AwaiterBenchmark.cs from tuning/Cuemon.Kernel.Benchmarks/ root to tuning/Cuemon.Kernel.Benchmarks/Threading/ to mirror the production code namespace Cuemon.Threading.
Extended AsyncRunOptions with two new properties: TimeProvider for testable time measurement and MaximumAttempts to enforce explicit attempt limits during zero-delay retries. Implemented IValidatableParameterObject to validate the zero-delay safeguard constraint. These features enable more flexible retry scenarios while preventing accidental unbounded retry loops.
Updated Awaiter.RunUntilSuccessfulOrTimeoutAsync to leverage new AsyncRunOptions properties. Now uses TimeProvider for time measurement instead of Task.Delay, respects MaximumAttempts when configured, and passes CancellationToken to the user delegate to enable cooperative cancellation support.
Added unit tests covering TimeProvider integration, MaximumAttempts enforcement, zero-delay safeguard validation, and CancellationToken propagation in the Awaiter retry loop. Updated benchmarks to reflect new method signatures and validate performance characteristics of the enhanced implementation.
Updated DocFX examples to demonstrate new AsyncRunOptions properties (TimeProvider, MaximumAttempts) and updated Awaiter usage to show cancellation token integration. Examples now cover zero-delay retry configuration, TimeProvider usage, and cancellation scenarios.
Added Microsoft.Bcl.TimeProvider v10.0.10 dependency for netstandard2.0 target framework to support TimeProvider abstraction in AsyncRunOptions. Updated Cuemon.Kernel.csproj to reference the polyfill package for netstandard2.0 targets.
Updated Condition.IsValidRelativeUri to use implicit type inference (var) instead of explicit type declaration, improving code readability and maintainability.
Changed MaximumAttempts from nullable int? to non-nullable int with a default value of 0. This simplifies the API by using 0 to indicate unlimited attempts instead of null. Updated validation logic, Awaiter implementation, and test expectations accordingly. When Delay is zero, MaximumAttempts must be explicitly set to a positive value to prevent unbounded retry loops.
Removed TimeProvider property from AsyncRunOptions and simplified the implementation to use System.Diagnostics.Stopwatch for timeout measurement. This eliminates the netstandard2.0 dependency on Microsoft.Bcl.TimeProvider while maintaining equivalent retry and timeout behavior. Updated Awaiter implementation, tests, and documentation accordingly.
Replace Stopwatch.StartNew() with Stopwatch.GetTimestamp() for better performance characteristics. Add GetElapsedTime() helper with .NET 9+ conditional compilation to calculate elapsed time efficiently. Optimize DelayAsync to return Task.CompletedTask instead of async/await pattern to reduce allocations. Benchmark results show improved performance across .NET 9.0 and .NET 10.0 runtimes.
Greptile SummaryThis release adds a portable case-insensitive physical file provider, revises asynchronous retry behavior, updates framework and package configuration, and substantially refreshes API documentation and examples.
Confidence Score: 5/5The PR appears safe to merge because no eligible new finding or known outstanding prior finding remains. No blocking failure remains within the provided follow-up-review scope. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Caller requests file, directory, or watch] --> B[Normalize logical path]
B --> C{Cached successful resolution?}
C -->|Yes| D[Reuse physical path]
C -->|No| E[Enumerate each path segment]
E --> F{Single case-insensitive match?}
F -->|Yes| G[Cache resolved physical path]
F -->|Missing or ambiguous| H[Return not found or null change token]
G --> I[Delegate to PhysicalFileProvider]
D --> I
Reviews (4): Last reviewed commit: "🚨 add namespace mismatch suppressions" | Re-trigger Greptile |
Task.Delay uses whole-millisecond resolution, and when retry delays are capped to remaining timeout windows they can become fractional milliseconds. The NormalizeDelay method now rounds these up to the next whole millisecond to prevent zero-delay busy loops when a capped delay would otherwise be truncated. This ensures retry delays remain positive even after timeout constraints.
Refactored Watch tests to establish a baseline PhysicalFileProvider and compare its behavior against PortablePhysicalFileProvider, ensuring consistent change notification semantics. Extracted AwaitChangeAsync into WaitForChangeAsync and AssertEquivalentChangeNotificationAsync for better composition of assertions. Also improved AssertEquivalentFileInfo to skip length assertion for non-existent files, and updated DistinctCaseEntriesUnsupportedReason to provide a sensible default message.
New benchmark project for measuring FileProviders.Physical performance across different file scenarios and workload sizes.
FileWatcher.UtcCreated now correctly initialized to UtcLastModified for consistency, and file-modified comparison now uses the tracked UtcLastModified instead of the instance creation time.
Benchmark suite measuring path resolution performance across cache hit/miss scenarios and file path complexity variations. Includes parameterized benchmarks for different directory depths, sibling counts, and path types. Performance data informs optimization decisions and baseline expectations for production deployments.
Updates DocFX namespace and type documentation to reflect the portable file provider implementation, caching strategy, and path resolution semantics. Clarifies cache entry sharing for equivalent logical paths and explains performance implications for cold lookups in wide directories.
Updates per-package release notes for all assemblies and adds README for the new Cuemon.Extensions.FileProviders.Physical package. Documents feature additions, API improvements, dependency updates, and breaking changes for each package component in the 10.6.0 release.
Release 10.6.0 focuses on portable file provider capabilities, async retry enhancements, and comprehensive dependency updates. Introduces PortablePhysicalFileProvider for cross-platform case-insensitive file resolution with intelligent caching. Refactors Awaiter with structured AsyncRunOptions configuration. Modernizes XML documentation and improves code quality patterns. Includes systematic dependency updates and critical bugfixes for FileWatcher and retry semantics.
Refactor FileDependency test to use TaskCompletionSource and ConcurrentQueue for more reliable async signal handling. Replaces CountdownEvent and List<DateTime> with modern async primitives, removes dependency on Cuemon.Extensions, and improves test directory lifecycle management with proper setup/teardown. Enhanced test readability and reliability with configurable timeout constants.
Minor improvements to threading test assertions and structure for consistency with updated FileDependencyTest patterns.
Streamline GlobalSetup initialization and improve benchmark measurement accuracy by reducing unnecessary allocations during setup phase.
Add new benchmark reports for cold directory/file lookups and collision scenarios. Remove outdated report for consolidated benchmark structure.
Remove outdated S2589 suppression for CyclicRedundancyCheck. Remove duplicate S107 suppression for DigestAuthorizationHeader constructor with 11 parameters. Remove S3776 suppression for AddEnumerableConverter that was addressed in recent refactoring. Clean up trailing whitespace in suppression file headers.
Replace traditional null check and assignment pattern with modern null-coalescing assignment operator (?=) for more concise and idiomatic C# code.
Apply file-scoped namespace syntax (namespace X;) consistently across all source and test projects. This modernizes the code structure to align with contemporary C# style conventions and improves overall readability by reducing nesting depth and visual indentation.
|
Too many files changed for review (1307 files, 500 file limit). |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #168 +/- ##
==========================================
+ Coverage 94.21% 94.22% +0.01%
==========================================
Files 602 604 +2
Lines 19283 19688 +405
Branches 2032 2104 +72
==========================================
+ Hits 18167 18552 +385
- Misses 1052 1072 +20
Partials 64 64 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…eam handling Add cancellation token support to async stream copy operations in authentication and caching middleware. Use XmlReader.Create() to properly manage stream resources and enable proper cleanup when XML documents are loaded from streams.
External test runners like JetBrains may host tests in a different target framework than the assembly was compiled for. Instead of failing the test, skip it when the runtime-reported TFM does not match the expected compile-time TFM. This prevents false negatives when running under non-built-in test runners.
Verify that XML encoding detection properly rejects Document Type Definitions (DTDs) to prevent XXE and entity expansion attacks. DTD entities should not be expanded when detecting encoding information.
Document bug fixes for async stream copy operations that now properly propagate cancellation tokens in authentication and caching middleware, and improvements to XML encoding detection resource cleanup.
Update CHANGELOG.md to clarify async stream copy operation improvements and add Security section documenting DTD rejection in XML encoding detection to prevent XXE and entity expansion attacks.
This pull request updates several API documentation code examples and summaries to improve clarity, accuracy, and real-world relevance. The main focus is on making example outputs more meaningful (e.g., displaying configuration values instead of type names), enhancing summary descriptions, and refining exception handling demonstrations.
Improvements to authentication and TagHelper examples:
BasicAuthenticationHandler,DigestAuthenticationHandler,HmacAuthenticationHandler) to print relevant configuration values (like realm or scheme) instead of just type names, making the output more useful and realistic. [1] [2] [3] [4] [5] [6]AppImageTagHelper,AppLinkTagHelper,AppScriptTagHelper,CdnImageTagHelper) to instantiate helpers with realistic property values and output constructed URLs, improving example clarity and practical application. [1] [2] [3] [4] [5]Enhancements to exception handling examples:
BadRequestException,ConflictException,PayloadTooLargeException,TooManyRequestsException,PreconditionFailedException,UnauthorizedException) to print exception messages and relevant details instead of just type names, and improved the demonstration of error conditions and output for better instructional value. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Documentation summary improvements:
Cuemon.Reflectionand added a new summary forCuemon.Extensions.FileProviders, clarifying their purposes and primary use cases. [1] [2]Other minor refinements:
ServerTimingFilterexample to print the presence of a predicate rather than the type name, making the output more relevant.These changes collectively make the documentation more actionable and easier to follow for developers learning to use these APIs.