You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OK, basically I had a test class. In the Test-Class was a member "IServiceProvider _serviceProvider". In the [TearDown]-method the service provider was disposed with the following code:
(_serviceProvider as IDisposable)?.Dispose();_serviceProvider=null;
When compiled I got the above mentioned error: Error NUnit1032: The field _serviceProvider should be Disposed in a method annotated with [TearDownAttribute] (https://github.com/nunit/nunit.analyzers/tree/master/documentation/NUnit1032.md)
IServiceProvider doesn’t inherit the IDisposable interface, hence the as operator in the TearDown method.
I explicitly call Dispose() in the TearDown method.
So why do I get this error message!? This is probably a bug.
OK, basically I had a test class. In the Test-Class was a member "IServiceProvider _serviceProvider". In the [TearDown]-method the service provider was disposed with the following code:
When compiled I got the above mentioned error:
Error NUnit1032: The field _serviceProvider should be Disposed in a method annotated with [TearDownAttribute] (https://github.com/nunit/nunit.analyzers/tree/master/documentation/NUnit1032.md)
IServiceProvider
doesn’t inherit theIDisposable
interface, hence theas
operator in the TearDown method.So why do I get this error message!? This is probably a bug.
So for reference, this is the NuGet Config:
The text was updated successfully, but these errors were encountered: