Skip to content

v4.0.0

Choose a tag to compare

@senrecep senrecep released this 06 Oct 07:57
· 369 commits to main since this release

4.0 changes default behavior in CSharpEssentials.AspNetCore, CSharpEssentials.EntityFrameworkCore and CSharpEssentials.Resilience. Each old behavior can be turned back on with a setting. Read Migrating from 3.x to 4.0 before upgrading.

Added

  • Enum query and route binding for Minimal API and MVC: services.AddEnumBinding() and app.UseEnumBinding().
  • IExceptionProblemMapper, IErrorStatusCodeMapper and IProblemDetailsEnricher extension points for ProblemDetails.
  • services.ConfigureInvalidModelStateResponse() writes the automatic [ApiController] 400 as an enhanced problem.
  • ConditionalStringEnumConverter.AllowUndefinedValues.
  • RetryIfFailed overloads with a Func<Error, bool> shouldRetry predicate.
  • SecretManagerConfigurationOptions.LoggerFactory for GCP Secret Manager logging.
  • Analyzer CSE0001 for [StringEnum] enums nested in a class or struct.

Changed

  • ProblemDetails output: W3C trace id, fewer request fields by default, RFC 9110 type URIs, validation-only errors, exception messages hidden in 500 responses. o.UseLegacyDefaults() restores the 3.x fields.
  • Minimal API, MVC, GlobalExceptionHandler and status code pages all write ProblemDetails through IProblemDetailsService.
  • ResultEndpointFilter returns ProblemDetails instead of a raw Error[].
  • StringEnumNaming is the single enum naming source for JSON, EF Core, Swagger and binding. UseLegacySnakeCase restores the 3.x EF Core spelling.
  • The non-generic ResiliencePolicy retries failed Result values, and caller cancellation throws OperationCanceledException.
  • CSharpEssentials.Resilience depends on Polly.Core instead of Polly. CSharpEssentials.GcpSecretManager depends on CSharpEssentials.Resilience.
  • Swashbuckle.AspNetCore is bounded to [8.1.0, 10), and CSharpEssentials.EntityFrameworkCore pins each target framework to its own EF Core major.
  • SecretManagerConfigurationOptions is a sealed record (binary-breaking for AddProject).

Fixed

  • PolymorphicJsonConverterFactory no longer wraps collection and dictionary interfaces in a $type envelope.
  • JsonOptions.ApplyTo keeps the target's TypeInfoResolver.
  • GCP Secret Manager retries listing and secret access on transient errors, and loads secrets without a shared mutable dictionary.
  • AddValidator and AddValidatorsFromAssembly no longer register the same validator twice.
  • default(ResiliencePolicy) behaves like Create().