Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CA1873: Avoid potentially expensive logging #7290

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/NetAnalyzers/Core/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CA1514 | Maintainability | Info | AvoidLengthCheckWhenSlicingToEndAnalyzer, [Doc
CA1515 | Maintainability | Disabled | MakeTypesInternal, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1515)
CA1871 | Performance | Info | DoNotPassNonNullableValueToArgumentNullExceptionThrowIfNull, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1871)
CA1872 | Performance | Info | PreferConvertToHexStringOverBitConverterAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1872)
CA1873 | Performance | Info | AvoidPotentiallyExpensiveCallWhenLoggingAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)
CA2022 | Reliability | Warning | AvoidUnreliableStreamReadAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2022)
CA2262 | Usage | Info | ProvideHttpClientHandlerMaxResponseHeaderLengthValueCorrectly, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2262)
CA2263 | Usage | Info | PreferGenericOverloadsAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2263)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,15 @@ Widening and user defined conversions are not supported with generic types.</val
<data name="UseStringMethodCharOverloadWithSingleCharactersTitle" xml:space="preserve">
<value>Use char overload</value>
</data>
<data name="AvoidPotentiallyExpensiveCallWhenLoggingDescription" xml:space="preserve">
<value>In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</value>
</data>
<data name="AvoidPotentiallyExpensiveCallWhenLoggingMessage" xml:space="preserve">
<value>Evaluation of this argument may be expensive and unnecessary if logging is disabled</value>
</data>
<data name="AvoidPotentiallyExpensiveCallWhenLoggingTitle" xml:space="preserve">
<value>Avoid potentially expensive logging</value>
</data>
<data name="AvoidSingleUseOfLocalJsonSerializerOptionsMessage" xml:space="preserve">
<value>Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead.</value>
</data>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
<target state="translated">Vyhněte se konstantním polím jako argumentům</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingDescription">
<source>In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</source>
<target state="new">In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingMessage">
<source>Evaluation of this argument may be expensive and unnecessary if logging is disabled</source>
<target state="new">Evaluation of this argument may be expensive and unnecessary if logging is disabled</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingTitle">
<source>Avoid potentially expensive logging</source>
<target state="new">Avoid potentially expensive logging</target>
<note />
</trans-unit>
<trans-unit id="AvoidSingleUseOfLocalJsonSerializerOptionsDescription">
<source>Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application.</source>
<target state="translated">Vyhněte se vytvoření nové instance JsonSerializerOptions pro každou operaci serializace. Místo toho ukládejte instance do mezipaměti a znovu je používejte. Instance JsonSerializerOptions pro jedno použití můžou výrazně snížit výkon vaší aplikace.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
<target state="translated">Konstantenmatrizen als Argumente vermeiden</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingDescription">
<source>In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</source>
<target state="new">In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingMessage">
<source>Evaluation of this argument may be expensive and unnecessary if logging is disabled</source>
<target state="new">Evaluation of this argument may be expensive and unnecessary if logging is disabled</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingTitle">
<source>Avoid potentially expensive logging</source>
<target state="new">Avoid potentially expensive logging</target>
<note />
</trans-unit>
<trans-unit id="AvoidSingleUseOfLocalJsonSerializerOptionsDescription">
<source>Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application.</source>
<target state="translated">Erstellen Sie für Serialisierungsvorgänge nicht jeweils eine neue JsonSerializerOptions-Instanz. Speichern Sie stattdessen Instanzen zwischen, und verwenden Sie sie wieder. Die einmalige Verwendung von JsonSerializerOptions-Instanzen kann die Leistung Ihrer Anwendung erheblich beeinträchtigen.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
<target state="translated">Evitar matrices constantes como argumentos</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingDescription">
<source>In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</source>
<target state="new">In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingMessage">
<source>Evaluation of this argument may be expensive and unnecessary if logging is disabled</source>
<target state="new">Evaluation of this argument may be expensive and unnecessary if logging is disabled</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingTitle">
<source>Avoid potentially expensive logging</source>
<target state="new">Avoid potentially expensive logging</target>
<note />
</trans-unit>
<trans-unit id="AvoidSingleUseOfLocalJsonSerializerOptionsDescription">
<source>Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application.</source>
<target state="translated">Evite crear una nueva instancia de "JsonSerializerOptions" para cada operación de serialización. En su lugar, almacene en caché y reutilice instancias. Las instancias "JsonSerializerOptions" de uso único pueden degradar considerablemente el rendimiento de la aplicación.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
<target state="translated">Éviter les tableaux constants en tant qu’arguments</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingDescription">
<source>In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</source>
<target state="new">In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingMessage">
<source>Evaluation of this argument may be expensive and unnecessary if logging is disabled</source>
<target state="new">Evaluation of this argument may be expensive and unnecessary if logging is disabled</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingTitle">
<source>Avoid potentially expensive logging</source>
<target state="new">Avoid potentially expensive logging</target>
<note />
</trans-unit>
<trans-unit id="AvoidSingleUseOfLocalJsonSerializerOptionsDescription">
<source>Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application.</source>
<target state="translated">Évitez de créer une instance « JsonSerializerOptions » pour chaque opération de sérialisation. Mettez en cache et réutilisez les instances à la place. Les instances « JsonSerializerOptions » à usage unique peuvent considérablement dégrader les performances de votre application.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
<target state="translated">Evitare matrici costanti come argomenti</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingDescription">
<source>In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</source>
<target state="new">In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingMessage">
<source>Evaluation of this argument may be expensive and unnecessary if logging is disabled</source>
<target state="new">Evaluation of this argument may be expensive and unnecessary if logging is disabled</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingTitle">
<source>Avoid potentially expensive logging</source>
<target state="new">Avoid potentially expensive logging</target>
<note />
</trans-unit>
<trans-unit id="AvoidSingleUseOfLocalJsonSerializerOptionsDescription">
<source>Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application.</source>
<target state="translated">Evitare di creare una nuova istanza di 'JsonSerializerOptions' per ogni operazione di serializzazione. Memorizzare nella cache le istanze e riutilizzarle. Le istanze monouso di 'JsonSerializerOptions' possono ridurre notevolmente le prestazioni dell'applicazione.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
<target state="translated">引数として定数配列を使用しない</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingDescription">
<source>In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</source>
<target state="new">In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingMessage">
<source>Evaluation of this argument may be expensive and unnecessary if logging is disabled</source>
<target state="new">Evaluation of this argument may be expensive and unnecessary if logging is disabled</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingTitle">
<source>Avoid potentially expensive logging</source>
<target state="new">Avoid potentially expensive logging</target>
<note />
</trans-unit>
<trans-unit id="AvoidSingleUseOfLocalJsonSerializerOptionsDescription">
<source>Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application.</source>
<target state="translated">シリアル化操作ごとに新しい 'JsonSerializerOptions' インスタンスを作成しないでください。代わりにインスタンスをキャッシュして再利用します。'JsonSerializerOptions' インスタンスの単独使用では、アプリケーションのパフォーマンスが大幅に低下する可能性があります。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
<target state="translated">상수 배열을 인수로 사용하지 않습니다.</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingDescription">
<source>In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</source>
<target state="new">In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingMessage">
<source>Evaluation of this argument may be expensive and unnecessary if logging is disabled</source>
<target state="new">Evaluation of this argument may be expensive and unnecessary if logging is disabled</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingTitle">
<source>Avoid potentially expensive logging</source>
<target state="new">Avoid potentially expensive logging</target>
<note />
</trans-unit>
<trans-unit id="AvoidSingleUseOfLocalJsonSerializerOptionsDescription">
<source>Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application.</source>
<target state="translated">모든 직렬화 작업에 대해 새 'JsonSerializerOptions' 인스턴스를 만들지 마세요. 대신 인스턴스를 캐시하고 다시 사용합니다. 단일 사용 'JsonSerializerOptions' 인스턴스는 애플리케이션의 성능을 크게 저하시킬 수 있습니다.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
<target state="translated">Unikaj tablic stałych jako argumentów</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingDescription">
<source>In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</source>
<target state="new">In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingMessage">
<source>Evaluation of this argument may be expensive and unnecessary if logging is disabled</source>
<target state="new">Evaluation of this argument may be expensive and unnecessary if logging is disabled</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingTitle">
<source>Avoid potentially expensive logging</source>
<target state="new">Avoid potentially expensive logging</target>
<note />
</trans-unit>
<trans-unit id="AvoidSingleUseOfLocalJsonSerializerOptionsDescription">
<source>Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application.</source>
<target state="translated">Unikaj tworzenia nowego wystąpienia „JsonSerializerOptions” dla każdej operacji serializacji. Zamiast tego buforuj i ponownie wykorzystuj wystąpienia. Jednorazowe użycie wystąpienia „JsonSerializerOptions” może znacznie obniżyć wydajność aplikacji.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
<target state="translated">Evite matrizes constantes como argumentos</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingDescription">
<source>In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</source>
<target state="new">In many situations, logging is disabled or set to a log level that results in an unnecessary evaluation for this argument.</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingMessage">
<source>Evaluation of this argument may be expensive and unnecessary if logging is disabled</source>
<target state="new">Evaluation of this argument may be expensive and unnecessary if logging is disabled</target>
<note />
</trans-unit>
<trans-unit id="AvoidPotentiallyExpensiveCallWhenLoggingTitle">
<source>Avoid potentially expensive logging</source>
<target state="new">Avoid potentially expensive logging</target>
<note />
</trans-unit>
<trans-unit id="AvoidSingleUseOfLocalJsonSerializerOptionsDescription">
<source>Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead. Single use 'JsonSerializerOptions' instances can substantially degrade the performance of your application.</source>
<target state="translated">Evite criar uma nova instância 'JsonSerializerOptions' para cada operação de serialização. Em vez disso, armazene em cache e reutilize instâncias. Instâncias 'JsonSerializerOptions' de uso único podem degradar substancialmente o desempenho de seu aplicativo.</target>
Expand Down