From b003b56e7bcf75d89a7e4ee526ca439fa703ff92 Mon Sep 17 00:00:00 2001 From: Staffan Gustafsson Date: Mon, 11 May 2020 20:57:31 +0200 Subject: [PATCH] Annotate `Assert` methods for better code analysis (#12618) --- src/System.Management.Automation/utils/assert.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/System.Management.Automation/utils/assert.cs b/src/System.Management.Automation/utils/assert.cs index 8fe3bc786b..921ed42c0f 100644 --- a/src/System.Management.Automation/utils/assert.cs +++ b/src/System.Management.Automation/utils/assert.cs @@ -11,6 +11,7 @@ #define DEBUG using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Text; namespace System.Management.Automation @@ -126,6 +127,7 @@ namespace System.Management.Automation #if RESHARPER_ATTRIBUTES [JetBrains.Annotations.AssertionCondition(JetBrains.Annotations.AssertionConditionType.IS_TRUE)] #endif + [DoesNotReturnIf(false)] bool condition, string whyThisShouldNeverHappen) { @@ -159,6 +161,7 @@ namespace System.Management.Automation #if RESHARPER_ATTRIBUTES [JetBrains.Annotations.AssertionCondition(JetBrains.Annotations.AssertionConditionType.IS_TRUE)] #endif + [DoesNotReturnIf(false)] bool condition, string whyThisShouldNeverHappen, string detailMessage) {