Compiler Error CS8410
'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
{
}
See also
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for