Skip to content

Commit 076392b

Browse files
committed
Revert analyzer suppression
1 parent 7f8b7d7 commit 076392b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Examples/DapperExample/Program.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@
3131
}
3232
case DatabaseProvider.MySql:
3333
{
34-
// https://github.com/dotnet/roslyn-analyzers/issues/7420
35-
#pragma warning disable CA1849 // Call async methods when in an async method
36-
builder.Services.AddMySql<AppDbContext>(connectionString, ServerVersion.AutoDetect(connectionString),
37-
#pragma warning restore CA1849 // Call async methods when in an async method
38-
optionsAction: options => SetDbContextDebugOptions(options));
34+
#if NET9_0_OR_GREATER
35+
ServerVersion serverVersion = await ServerVersion.AutoDetectAsync(connectionString);
36+
#else
37+
ServerVersion serverVersion = ServerVersion.AutoDetect(connectionString);
38+
#endif
39+
40+
builder.Services.AddMySql<AppDbContext>(connectionString, serverVersion, optionsAction: options => SetDbContextDebugOptions(options));
3941

4042
break;
4143
}

0 commit comments

Comments
 (0)