HttpResponseBase.Cache is typed incorrectly as HttpCachePolicy; Causes MissingMethodException
AvremelM opened this issue · 0 comments
AvremelM commented
Describe the bug
Currently, HttpResponseBase.Cache
is typed as HttpCachePolicy
. It should be HttpCachePolicyBase
(a type that doesn't yet exist in SystemWebAdapters). See referencesource
To Reproduce
// in .netstandard2.0 library
public void TestMethod()
{
HttpResponseBase responseBase = new HttpResponseWrapper(HttpContext.Current.Response);
responseBase.Cache.SetCacheability(HttpCacheability.NoCache);
}
// In ASP.NET Framework application
TestMethod();
Exceptions (if any)
System.MissingMethodException: Method not found: 'System.Web.HttpCachePolicy System.Web.HttpResponseBase.get_Cache()'.
This exception happens at runtime.