C# Error
CS8410 – ‘{0}’: type used in an asynchronous using statement must be implicitly convertible to ‘System.IAsyncDisposable’ or implement a suitable ‘DisposeAsync’ method.
Reason for the Error & Solution
‘type’: type used in an asynchronous using statement must be implicitly convertible to ‘System.IAsyncDisposable’ or implement a suitable ‘DisposeAsync’ method.
The expression inside an await using
statement must have a DisposeAsync
method.
To correct this error
Remove the await using
keywords, or implement a suitable DisposeAsync
method.
Example
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
// error CS8410: 'Example': type used in an asynchronous using statement
// must be implicitly convertible to 'System.IAsyncDisposable' or implement
// a suitable 'DisposeAsync' method.
await using var example = new Example();
}
}
class Example
{
}