Skip to content

Commit 9c42d4a

Browse files
authored
feat: Add dx to catch ConfigureAwait(false) (#152)
Signed-off-by: Benjamin Evenson <[email protected]>
1 parent dd92cbf commit 9c42d4a

File tree

6 files changed

+12
-0
lines changed

6 files changed

+12
-0
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ dotnet_diagnostic.IDE0005.severity = none
146146
# RS0041: Public members should not use oblivious types
147147
dotnet_diagnostic.RS0041.severity = suggestion
148148

149+
# CA2007: Do not directly await a Task
150+
dotnet_diagnostic.CA2007.severity = error
151+
149152
[obj/**.cs]
150153
generated_code = true
151154

build/Common.props

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<PropertyGroup>
33
<LangVersion>7.3</LangVersion>
44
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
5+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
56
</PropertyGroup>
67

78
<PropertyGroup Condition="'$(Configuration)'=='Debug'">

test/OpenFeature.Benchmarks/OpenFeatureClientBenchmarks.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
using System.Collections.Immutable;
3+
using System.Diagnostics.CodeAnalysis;
34
using System.Threading.Tasks;
45
using AutoFixture;
56
using BenchmarkDotNet.Attributes;
@@ -12,6 +13,7 @@ namespace OpenFeature.Benchmark
1213
[SimpleJob(RuntimeMoniker.Net60, baseline: true)]
1314
[JsonExporterAttribute.Full]
1415
[JsonExporterAttribute.FullCompressed]
16+
[SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task")]
1517
public class OpenFeatureClientBenchmarks
1618
{
1719
private readonly string _clientName;

test/OpenFeature.Tests/FeatureProviderTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Diagnostics.CodeAnalysis;
12
using System.Threading.Tasks;
23
using AutoFixture;
34
using FluentAssertions;
@@ -9,6 +10,7 @@
910

1011
namespace OpenFeature.Tests
1112
{
13+
[SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task")]
1214
public class FeatureProviderTests : ClearOpenFeatureInstanceFixture
1315
{
1416
[Fact]

test/OpenFeature.Tests/OpenFeatureClientTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Immutable;
3+
using System.Diagnostics.CodeAnalysis;
34
using System.Linq;
45
using System.Threading.Tasks;
56
using AutoFixture;
@@ -16,6 +17,7 @@
1617

1718
namespace OpenFeature.Tests
1819
{
20+
[SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task")]
1921
public class OpenFeatureClientTests : ClearOpenFeatureInstanceFixture
2022
{
2123
[Fact]

test/OpenFeature.Tests/OpenFeatureHookTests.cs

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Collections.Immutable;
4+
using System.Diagnostics.CodeAnalysis;
45
using System.Linq;
56
using System.Threading.Tasks;
67
using AutoFixture;
@@ -14,6 +15,7 @@
1415

1516
namespace OpenFeature.Tests
1617
{
18+
[SuppressMessage("Reliability", "CA2007:Consider calling ConfigureAwait on the awaited task")]
1719
public class OpenFeatureHookTests : ClearOpenFeatureInstanceFixture
1820
{
1921
[Fact]

0 commit comments

Comments
 (0)