Skip to content

HttpResponseBase.Cache is typed incorrectly as HttpCachePolicy; Causes MissingMethodException #476

@AvremelM

Description

@AvremelM

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Triage 🔍Label added to new issues which need Triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions