Type of issue
Missing information
Description
The rule searches the methods called by T.Dispose and one level lower (that is, the methods called by the methods called by T.Dispose).
Is this statement related to T's methods only?
I tried to define extension method, but I couldn't use it without CA2213 warning:
public static void DisposeNoExcept(this IDisposable iDisposable, Action<Exception> onException)
{
if (iDisposable == null)
{
throw new ArgumentNullException("iDisposable");
}
if (onException == null)
{
throw new ArgumentNullException("onException");
}
try
{
iDisposable.Dispose();
}
catch (Exception obj)
{
try
{
onException(obj);
}
catch (Exception)
{
}
}
}
Page URL
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2213
Content source URL
https://github.com/dotnet/docs/blob/main/docs/fundamentals/code-analysis/quality-rules/ca2213.md
Document Version Independent Id
36081ff5-7b95-58ac-a8a2-5a38d36184bb
Platform Id
2bc1e713-8c68-6bb9-9ab3-55dcbc17d51c
Article author
@gewarren
Metadata
- ID: 924b174f-c902-9ba3-f7ff-6dd186ccc635
- PlatformId: 2bc1e713-8c68-6bb9-9ab3-55dcbc17d51c
- Service: dotnet-fundamentals
Related Issues
Type of issue
Missing information
Description
Is this statement related to
T's methods only?I tried to define extension method, but I couldn't use it without CA2213 warning:
Page URL
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca2213
Content source URL
https://github.com/dotnet/docs/blob/main/docs/fundamentals/code-analysis/quality-rules/ca2213.md
Document Version Independent Id
36081ff5-7b95-58ac-a8a2-5a38d36184bb
Platform Id
2bc1e713-8c68-6bb9-9ab3-55dcbc17d51c
Article author
@gewarren
Metadata
Related Issues