protocolbuffers / protocolbuffers/protobuf
Dotnet - Include key name when failing to add to a MapField due to a duplicate key
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 72k
- Forks
- 16.3k
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 140
Description
What language does this apply to?
C#/dotnet
Describe the problem you are trying to solve.
Trying to understand why adding a key to a MapField fails
Describe the solution you'd like
The Argument exception should contain the name of the key that failed being added
https://github.com/protocolbuffers/protobuf/blob/54d8f03974c108ef8fd0f26568cd9eb086165568/csharp/src/Google.Protobuf/Collections/MapField.cs#L97
Describe alternatives you've considered
None
Additional context
We aren't using this library directly, but through a 3rd party library that uses Google.Cloud.Logging.V2, making debugging challenging
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in csharp/src/Google.Protobuf/Collections/MapField.cs at the linked failure location and inspect how duplicate keys are reported. Reproduce an attempted duplicate-key addition and update the exception behavior so the failing key name is included; done means the exception identifies that key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100