Posted on 27/10/2025 14:06:30
Hi Kevin,
It's a little bit of both. Specifically, it's related to the legacy context from .NET Framework.
IHttpContextAccessor.HttpContext.Items is of type IDictionary<object, object?> but the Items property on IContext is of type IDictionary. Since no direct type conversion exists between those two, we create a new Dictionary<object, object?> from HttpContext.Items to use in IContext.Items. That's why the two objects are different.
Originally, we did not intend that the Items collection should be accessed directly using the HttpContext, so it was fine to create a wrapper around it. However, that's no longer the case. The whole context concept could do with a update, but we can start here, since it can be fixed in a non-breaking way. While I don't think we can avoid having a wrapper around the collection, we can make sure that entries are added back to the underlying collection.
I've added a work item to make that change. You can follow along here: https://doc.dynamicweb.dev/documentation/fundamentals/dw10release/releasenotes/workItemInfo.html?workitemid=26090
- Jeppe