dotnet / dotnet/aspnetcore

HeaderDictionary.Enumerator.Reset() does not work.

Open
#61,699 0 comments 0 reactions 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

Calling `Reset()` on `HeaderDictionary.Enumerator` does not result in the enumerator being reset.

The issue is caused by the cast shown [here](https://github.com/dotnet/aspnetcore/blob/9f2b0880ff3c09db4a8915d62788a7d1ba62df64/src/Http/Http/src/HeaderDictionary.cs#L454) which results in the underlying enumerator being copied by value.

### Expected Behavior

The enumerator is reset to the initial state.

### Steps To Reproduce

https://github.com/CoryCharlton/HeaderDictionary_Enumerator_Reset

### Exceptions (if any)

_No response_

### .NET Version

9.0.203

### Anything else?

PR that implements proposed fix is [here](https://github.com/dotnet/aspnetcore/pull/61701).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.