Skip to content

Commit b003b56

Browse files
authored
Annotate Assert methods for better code analysis (PowerShell#12618)
1 parent 440e02e commit b003b56

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • src/System.Management.Automation/utils

‎src/System.Management.Automation/utils/assert.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define DEBUG
1212

1313
using System.Diagnostics;
14+
using System.Diagnostics.CodeAnalysis;
1415
using System.Text;
1516

1617
namespace System.Management.Automation
@@ -126,6 +127,7 @@ internal static void Assert(
126127
#if RESHARPER_ATTRIBUTES
127128
[JetBrains.Annotations.AssertionCondition(JetBrains.Annotations.AssertionConditionType.IS_TRUE)]
128129
#endif
130+
[DoesNotReturnIf(false)]
129131
bool condition,
130132
string whyThisShouldNeverHappen)
131133
{
@@ -159,6 +161,7 @@ internal static void
159161
#if RESHARPER_ATTRIBUTES
160162
[JetBrains.Annotations.AssertionCondition(JetBrains.Annotations.AssertionConditionType.IS_TRUE)]
161163
#endif
164+
[DoesNotReturnIf(false)]
162165
bool condition,
163166
string whyThisShouldNeverHappen, string detailMessage)
164167
{

0 commit comments

Comments
 (0)