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
HeaderNames now contains static readonly fields instead of const fields
The static Microsoft.Net.Http.Headers.HeaderNames class contains string fields representing various common header names (e.g. HeaderNames.Origin). Starting in ASP.NET Core 3.0 Preview 5, these will change from const fields to static readonly fields.
The change prevents the values from being embedded across assembly boundaries allowing for value corrections as needed. It also enables faster reference equality checks.
Recommended action
Recompile against 3.0. Source code that used these fields as an attribute argument, a case in a switch statement, or when defining another constant will no longer be able to do so. To work around this break, developers can switch to using self-defined header name constants or string literals.
HeaderNames now contains static readonly fields instead of const fields
The static Microsoft.Net.Http.Headers.HeaderNames class contains string fields representing various common header names (e.g. HeaderNames.Origin). Starting in ASP.NET Core 3.0 Preview 5, these will change from const fields to static readonly fields.
See dotnet/aspnetcore#9514 for discussion.
Version introduced
3.0
Old behavior
These fields used to be
const
New behavior
These fields are now
static readonly
.Reason for change
The change prevents the values from being embedded across assembly boundaries allowing for value corrections as needed. It also enables faster reference equality checks.
Recommended action
Recompile against 3.0. Source code that used these fields as an attribute argument, a case in a switch statement, or when defining another constant will no longer be able to do so. To work around this break, developers can switch to using self-defined header name constants or string literals.
Category
Affected APIs
All fields on Microsoft.Net.Http.Headers.HeaderNames
Issue metadata
The text was updated successfully, but these errors were encountered: