Conversation
Switched GetAsync and DropAsync from predicate-based overloads (x => x.Id == key.Value) to the direct ID overloads already provided by Tharga.MongoDB: GetOneAsync(TKey id) and DeleteOneAsync(TKey id). Slightly faster and clearer; removes three TODO comments.
The previous single Pack step always stamped the stable version into the artifact, even on PR runs. The publish job (running with the prerelease environment on PRs) would then push that stable .nupkg to NuGet — minting the next stable patch under a GitHub pre-release tag and blocking the eventual master release via --skip-duplicate. Split into two conditional Pack steps and added a dedicated 'Compute pre-release version' step in the build job: - Pack (stable) — only on push to master, uses version output - Pack (pre-release) — only on pull_request, uses preversion output Reference template: Tharga.Mcp / Tharga.Blazor.
GitHub Actions (.github/workflows/build.yml) is now the only CI/CD. Azure DevOps pipeline was disabled after the 0.4.0 release.
Wrap both Assembly.GetTypes() call sites (RegisterIPersistFromAssembly and InvokeAllPersistRegistrations) in a GetTypesSafe helper that catches ReflectionTypeLoadException and returns the types that did load. Warns once per affected assembly via Console.Error so the root cause isn't silently swallowed. Reported by PlutusWave: a Quilt4Net.Toolkit / Microsoft.ApplicationInsights version mismatch in an unrelated dll caused AddCache() to crash during startup with no indication that a third-party dll was the culprit. With this fix the consumer's app starts and emits a warning naming the offending assembly. Tests: - Normal assembly returns all types unchanged. - Throwing assembly returns only the loaded types and does not propagate the exception.
xUnit v3 added the xUnit1051 analyzer which warns on every Task.Delay without TestContext.Current.CancellationToken. That added ~17 warnings across our short-running test methods, pushing the CI threshold (10) into failure. - Suppress xUnit1051 in both test csproj NoWarn (stylistic, our tests are short-lived; bolting on a CancellationToken adds noise without improving correctness). - Suppress CS0618 in ObsoleteTests.cs via #pragma — the file deliberately references the obsolete IMemoryWithRedis to assert it's marked [Obsolete]. - Drop nullable annotations from GetTypesSafeTests.ThrowingAssembly (test project doesn't have <Nullable>enable</Nullable>); fixes CS8632. Local warning count: 38 → 2 (the single CS0162 for the unreachable 'yield break' in File.FindAsync, counted once per target framework).
The earlier 'update nuget packages' commit bumped Tharga.Console from 3.7.2 to 4.0.0, which is a breaking major version that restructured the Tharga.Console.Commands.Base namespace (ContainerCommandBase, ActionCommandBase, AsyncActionCommandBase no longer resolve from the old using). The sample failed to build on CI as a result. Reverting just the sample's package reference back to 3.7.2 so the CI build is green. Adapting the sample to the 4.0.0 API is a separate follow-up.
DropEvenIfUsed(keep: True) flaked on CI: at t=400 with TTL=400 the third Get hit the expiration boundary, sometimes returning the still- fresh original instead of refetching. Final Get then returned 'a4' instead of the expected 'a3'. Bumped delays to 250/250/300 (was 200/200/250) so every assertion now sits >= 100ms away from the boundary on slow runners. Same change applied to TimeToIdleCacheTests.KeepIfUsed for symmetry.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resilience fix for
AddCache()plus CI/cleanup work.Library
ReflectionTypeLoadException(PlutusWave / High). BothAssembly.GetTypes()call sites inCacheRegistrationExtensions(RegisterIPersistFromAssembly,InvokeAllPersistRegistrations) now go through aGetTypesSafehelper that catches the exception and returns the types that did load. Warns once per affected assembly viaConsole.Errorso the root cause isn't silently swallowed. PlutusWave hit a fatal startup crash from an unrelated Quilt4Net.Toolkit / Microsoft.ApplicationInsights dll mismatch — with this fix, the consumer's app starts and prints a warning naming the offending assembly.GetOneAsync(x => x.Id == key.Value, ...)/DeleteOneAsync(x => x.Id == item.Id, ...). Slightly faster, clearer; removes three TODO comments.CI
build.yml(Tharga.Blazor / Medium). The previous singlePackstep always stamped the stable version into the artifact, even on PR runs — the publish job would then push that stable .nupkg and--skip-duplicatewould block the eventual master release. Split into two conditionalPacksteps and added aCompute pre-release versionstep in the build job. All 5 packages updated (Tharga.Cache, .Redis, .MongoDB, .File, .Blazor).azure-pipelines.yml,buildnumber.yml). GitHub Actions is now the only CI/CD; AzDO pipeline was disabled after the 0.4.0 release.Sample / cleanup
CacheMonitorController.GetTyperesolves type by name via_cacheMonitor.GetInfos().FirstOrDefault(x => x.Type.Name == type). Was hardcoded toWeatherForecast[]. Returns 404 when the type isn't found.// TODO: Return all types automatically+ commentedGenericCache/GenericTimeCachelines fromAllTypestest helper (over-engineering for 3 concrete cache types).// TODO: Enable this method in future version, so that memory will be defaultfromCacheOptions— explicitRegisterType<TCache, TPersist>()is clearer than a silent default.Tests
GetTypesSafeTests.cs: normal assembly returns all types; throwing assembly returns only loaded types; throwing assembly does not propagate.Test plan
.nupkgartifacts have the0.4.x-pre.Nversion (not stable).0.4.xand creates a GitHub release.