Skip to content

Unable to cast object of type 'System.Web.SessionState.SessionStateItemCollection' to type 'Microsoft.Web.Redis.ChangeTrackingSessionStateItemCollection'. #111

Open
@footcha

Description

@footcha

Hello,
last week we started using Microsoft.Web.RedisSessionStateProvider in our live environments globally. Since then we are experiecing tens of millions exceptions per day (a log bellow is exported from Application Insights):

[{
    "severityLevel": "Critical",
    "outerId": "57776361",
    "message": "Unable to cast object of type 'System.Web.SessionState.SessionStateItemCollection' to type 'Microsoft.Web.Redis.ChangeTrackingSessionStateItemCollection'.",
    "parsedStack": [{
        "assembly": "Microsoft.Web.RedisSessionStateProvider, Version=3.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
        "method": "Microsoft.Web.Redis.RedisConnectionWrapper.SetPrepare",
        "level": 0,
        "line": 0
    },
    {
        "assembly": "Microsoft.Web.RedisSessionStateProvider, Version=3.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
        "method": "Microsoft.Web.Redis.RedisConnectionWrapper.Set",
        "level": 1,
        "line": 0
    },
    {
        "assembly": "Microsoft.Web.RedisSessionStateProvider, Version=3.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35",
        "method": "Microsoft.Web.Redis.RedisSessionStateProvider+<SetAndReleaseItemExclusiveAsync>d__25.MoveNext",
        "level": 2,
        "line": 0
    }],
    "type": "System.InvalidCastException",
    "id": "12895194"
}]

After two days of investigations I still cannot say preciselly which part of ASP.Net pipeline is responsible for passing object of type SessionStateItemCollection into a method RedisSessionStateProvider.SetAndReleaseItemExclusiveAsync.

It seems that despite such a huge number of exceptions it does not have remarkable negative impact on user experience. Still, this issue makes me worried a lot.

I will prepare a pull request to eliminate such errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions