You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update IDistributedCache to account for nullability #52148
The Get and GetAsync methods of the IDistributedCache interface do not match the intended nullability in terms of return type. As per the API documentation:
- byte[] data = cache.Get(key);+ byte[]? data = cache.Get(key);
Alternative Designs
The alternative is to keep the current API. This presents a difficulty when adding nullability checks in implementations of IDistributedCache see dotnet/aspnetcore#32266.
Risks
Implementations of the IDistributedCache interface will need to be updated to account for the nullability changes proposed here.
FYI @ericstj@maryamariyan, it seems like nullability is not enabled for Microsoft.Extensions.Caching.Abstractions package. Although only the IDistributedCache API is blocking the merging of the PR in aspnetcore, maybe it's a good opportunity to review the other APIs in the package and enable nullability for the package?
Is there an estimate of which preview when Caching.Abstractions will be annotated? We can't enable nullability in our package until it's enabled here first.
FYI, we don't need all of Caching.Abstractions to be updated with nullability enabled. To unblock us, we just need to make the tactical API changes I proposed.
cc @jeffhandley
Annotating Extensions (as well as other dotnet/runtime packages) isn't committed for 6.0 but we would like to see progress on it, it doesn't look like you're blocked on it, so I'm not seeing a need to raise priority or track as an independent issue. Let me know if I'm misunderstanding.
What's the nullable goal for ASP.NET in 6.0? Are you planning to enable it for all apps? You'll need more than just these assemblies annotated. Aren't there other assemblies that ship in the ASP.NET ref-pack which aren't annotated yet?
Activity
JunTaoLuo commentedon May 1, 2021
FYI @ericstj @maryamariyan, it seems like nullability is not enabled for
Microsoft.Extensions.Caching.Abstractionspackage. Although only theIDistributedCacheAPI is blocking the merging of the PR in aspnetcore, maybe it's a good opportunity to review the other APIs in the package and enable nullability for the package?eerhardt commentedon May 3, 2021
See #43605. Almost none of the Microsoft.Extensions.* libraries have nullability enabled.
JunTaoLuo commentedon May 3, 2021
Is there an estimate of which preview when Caching.Abstractions will be annotated? We can't enable nullability in our package until it's enabled here first.
JunTaoLuo commentedon May 3, 2021
FYI, we don't need all of Caching.Abstractions to be updated with nullability enabled. To unblock us, we just need to make the tactical API changes I proposed.
ericstj commentedon May 3, 2021
cc @jeffhandley
Annotating Extensions (as well as other dotnet/runtime packages) isn't committed for 6.0 but we would like to see progress on it, it doesn't look like you're blocked on it, so I'm not seeing a need to raise priority or track as an independent issue. Let me know if I'm misunderstanding.
maryamariyan commentedon May 3, 2021
For Caching.Abstractions, looks like it depends on primitives. So it would be only a matter of enabling nullables for these two libraries
JunTaoLuo commentedon May 3, 2021
It is blocking us from enabling nullability in Caching.SqlServer and Caching.StackExchangeRedis as part of dotnet/aspnetcore#5680.
ericstj commentedon May 3, 2021
What's the nullable goal for ASP.NET in 6.0? Are you planning to enable it for all apps? You'll need more than just these assemblies annotated. Aren't there other assemblies that ship in the ASP.NET ref-pack which aren't annotated yet?
eerhardt commentedon Jul 19, 2021
We've reached feature complete for .NET 6. Moving to 7.
maryamariyan commentedon Dec 23, 2021
Looking again at #43605, all dependencies to
Microsoft.Extensions.Caching.Abstractionsare nullable annotated. So would be good to fix this next.