getsentry / getsentry/sentry-dotnet

Add string.Format analyzer to IDiagnosticLogger.Log methods

Open
#3,926 1 comment 1 reaction 0 assignees View on GitHub
.NET Improvement Roslyn
Dominant language
C#
Stars
770
Forks
248
Avg merge
3d 4h
Merged PRs (30d)
49

Description

_Originally posted by @bruno-garcia in https://github.com/getsentry/sentry-dotnet/issues/3923#issuecomment-2622572068_

See issue #3922

Basically _someone_ (yeah, OK, it was me) accidentally used the wrong index in the format string when calling LogDebug.

As Bruno points out, we should use an analyzer to prevent this happening in the future, since it could crash the user's application.

# Solutions

We could quickly enable this for JetBrains IDEs like so:
* [Code analysis in custom string formatting methods](https://www.jetbrains.com/help/fleet/code-analysis-string-formatting-methods.html#custom)

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.