Skip to content

HybridCache: MissingMethodException (HybridCacheEntryOptions.ToDistributedCacheEntryOptions) on .NET 11 preview — no net11-aligned Microsoft.Extensions.Caching.Hybrid published #130376

Description

@gkizior

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

On .NET 11 preview (SDK 11.0.100-preview.5.26302.115), any HybridCache write that reaches the L2 (distributed) cache throws MissingMethodException for HybridCacheEntryOptions.ToDistributedCacheEntryOptions, logged by the framework as "Cache backend write failure."

HybridCacheEntryOptions ships in the Microsoft.Extensions.Caching.Abstractions assembly (part of the .NET 11 shared framework). The Microsoft.Extensions.Caching.Hybrid implementation package (latest 10.7.0) — DefaultHybridCache — calls HybridCacheEntryOptions.ToDistributedCacheEntryOptions on its L2 write path. On net11 the framework's HybridCacheEntryOptions no longer exposes that member (binary-breaking), so the 10.x impl fails at runtime.

There is no net11-aligned Microsoft.Extensions.Caching.Hybrid available: nuget.org tops out at 10.7.0, and the dnceng/public dotnet-public, dotnet10, and dotnet11 feeds have no 11.0.0-preview.* for this package. So there is currently no way to use HybridCache with an L2 cache on .NET 11.

Expected Behavior

HybridCache writes to an L2 IDistributedCache succeed on .NET 11 (a net11-aligned Hybrid package is published, or the abstraction change is made non-breaking).

Steps To Reproduce

Target net11.0, reference Microsoft.Extensions.Caching.Hybrid 10.6.0 or 10.7.0:

var services = new ServiceCollection();
services.AddDistributedMemoryCache();     // any IDistributedCache => HybridCache uses it as L2
services.AddHybridCache();
var sp = services.BuildServiceProvider();
var cache = sp.GetRequiredService<HybridCache>();

// Writes L1 then background-writes L2 -> throws
await cache.GetOrCreateAsync("key", _ => ValueTask.FromResult(42));

Exceptions (if any)

System.MissingMethodException: Method not found: 'Microsoft.Extensions.Caching.Hybrid.HybridCacheEntryOptions.ToDistributedCacheEntryOptions'.
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.g__ToDistributedCacheEntryOptions|57_0(HybridCacheEntryOptions options)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.GetL2DistributedCacheOptions(HybridCacheEntryOptions options)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.WritePayloadAsync(String key, CacheItem cacheItem, BufferChunk payload, HybridCacheEntryOptions options, CancellationToken token)
at Microsoft.Extensions.Caching.Hybrid.Internal.DefaultHybridCache.StampedeState`2.BackgroundFetchAsync()

.NET Version

11.0.100-preview.5.26302.115

Anything else?

  • Package versions tried: Microsoft.Extensions.Caching.Hybrid 10.6.0 and 10.7.0 — both fail identically.
  • Impact: L1 (in-memory) cache still works; only L2/distributed writes fail — so it's non-fatal but disables distributed HybridCache on net11.
  • Feeds checked for a net11 build (none found): nuget.org, dnceng/public/dotnet-public, .../dotnet10, .../dotnet11.
  • Root cause appears to be a binary-breaking change to HybridCacheEntryOptions in the net11 Microsoft.Extensions.Caching.Abstractions without a correspondingly-rebuilt Microsoft.Extensions.Caching.Hybrid.

Metadata

Metadata

Assignees

Labels

area-Extensions-Cachingin-prThere is an active PR which will close this issue when it is merged

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions