Skip to content

Commit

Permalink
fixed build.... freaking code anylsis
Browse files Browse the repository at this point in the history
  • Loading branch information
gentledepp committed Dec 7, 2023
1 parent 1f1254c commit 3534396
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)SharedKey.snk</AssemblyOriginatorKeyFile>
<!-- Explanation for the condition https://github.com/dotnet/cli/issues/6911#issuecomment-309647478 and https://github.com/dotnet/cli/issues/6911#issuecomment-310099022 -->
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<RunAnalyzersDuringBuild>True</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>True</RunAnalyzersDuringLiveAnalysis>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<AnalysisLevel>6.0-minimum</AnalysisLevel>
</PropertyGroup>

<ItemGroup>
Expand Down
15 changes: 12 additions & 3 deletions src/Castle.Core.AsyncInterceptor/NoCoverage/RethrowHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ internal static class RethrowHelper
/// <param name="exception">The exception.</param>
public static void Rethrow(this Exception? exception)
{
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(exception, nameof(exception));
#else
if (exception == null)
throw new ArgumentNullException(nameof(exception));

#endif
ExceptionDispatchInfo.Capture(exception).Throw();
}

Expand All @@ -32,9 +35,12 @@ public static void Rethrow(this Exception? exception)
/// <param name="exception">The exception.</param>
public static void RethrowInnerIfAggregate(this Exception? exception)
{
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(exception, nameof(exception));
#else
if (exception == null)
throw new ArgumentNullException(nameof(exception));

#endif
switch (exception)
{
case AggregateException aggregate:
Expand All @@ -53,9 +59,12 @@ public static void RethrowInnerIfAggregate(this Exception? exception)
/// <param name="task">The task.</param>
public static void RethrowIfFaulted(this Task task)
{
#if NET6_0_OR_GREATER
ArgumentNullException.ThrowIfNull(task, nameof(task));
#else
if (task == null)
throw new ArgumentNullException(nameof(task));

#endif
if (task.IsFaulted)
RethrowInnerIfAggregate(task.Exception);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<RunAnalyzersDuringBuild>True</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>True</RunAnalyzersDuringLiveAnalysis>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<EnableNETAnalyzers>True</EnableNETAnalyzers>
<AnalysisLevel>6.0-minimum</AnalysisLevel>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 3534396

Please sign in to comment.