Use C# 15 collection expression arguments for collections built with a comparer or capacity
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp
- Domain
- developer-experience
Research direction
Start with Directory.Build.props to find the pinned LangVersion, then inspect the listed collection constructions, especially the 12 in Protocol/Envelopes/EnvelopeItem.cs. Raise the language version to 15 and replace eligible comparer or capacity constructor calls with collection expressions using with(...). Review the other named files and build the project for its target frameworks to confirm the cleanup compiles without behavior changes.
Written by the indexing model from the issue text.
Description
C# 15 lets a collection expression pass constructor arguments with a with(...) element:
Dictionary<string, object?> data = [with(StringComparer.Ordinal), .. source];
HashSet<string> keys = [with(capacity: count)];
About 22 places in src/ (as of version7) build a Dictionary, HashSet or ConcurrentDictionary with a comparer or capacity argument, and could use this form. 12 of them are in Protocol/Envelopes/EnvelopeItem.cs. Others are in Envelope.cs, CocoaExtensions.cs, DynamicSamplingContext.cs, JsonExtensions.cs, SentrySpanProcessor.cs, SentryTracingMiddleware.cs, HttpContextExtensions.cs and AssemblyStoreExplorer.cs.
This is a readability cleanup only, with no behaviour change. The feature needs no runtime support, so it compiles for every TFM, including netstandard2.0 and net462.
Prerequisite
version7 builds with the .NET 11 SDK but pins <LangVersion>14.0</LangVersion> in Directory.Build.props. Raise it to 15 first, either as part of this change or separately.
See What's new in C# 15.
- Dominant language
- C#
- Stars
- 775
- Forks
- 262
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 118
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from getsentry/sentry-dotnet
-
chore: remove stale IL3050/IL3053 workaround from the iOS samplePossibly taken A pull request linked to this issue is open or already merged. OpenState: Needs Discussion
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
getsentry/sentry-dotnet#6071 · 1 comment ·
Maintainers usually reply within 1 day
-
Heap dumps: every SDK shutdown logs "Error waiting for GarbageCollectionMonitor task to complete"Possibly taken @pcbeingused33 claimed this today. OpenState: Needs Discussion
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
getsentry/sentry-dotnet#6039 · 3 comments ·
Maintainers usually reply within 1 day
-
.NET Platform: Android Task
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
getsentry/sentry-dotnet#6020 · 3 comments ·
Maintainers usually reply within 1 day
-
Move the Blazor WebAssembly sample off the deprecated DevServerPossibly taken A pull request linked to this issue is open or already merged. Open.NET Framework: Blazor
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
getsentry/sentry-dotnet#5906 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Docs MSBuild Needs Docs Update
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
getsentry/sentry-dotnet#5691 · 1 comment ·
Maintainers usually reply within 1 day
All issues in getsentry/sentry-dotnet
Similar issues
-
In-car displays show 0 km/h and P while the AV drivesPossibly taken @bazilinskyy claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
bazilinskyy/coupled-sim#366 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
BaryoDev/umbraco-pwa#196 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
microsoft/fluentui-blazor#5688 ·
Maintainers usually reply within 1 day
-
bug flaky lsp-transport small
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day