-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method that are returning disposable object, the return object shouldn't marked inside the method #38
Comments
@mhamri Thanks for reporting the bug. What is the return type of serviceProvider.GetService<ILoggerFactory>()
.AddConsole(configuration.GetSection("Logging:Console"))
.AddProvider(new LoggerFileProvider(configuration.GetSection("Logging:File"))); Is this ILoggerFactory and does it implement IDisposable? |
yes return type is iLoggerFactory this is the ILoggerFactory:
|
It seems to me, that this is one in a few cases, that should not be disposed. Unfortunately I was not able to figure out a way, to automatically detect this situations. Currently I use a list of types, that should be ignored during disposable detection. IgnoredInterfaces = new HashSet<string> {
"System.Collections.Generic.IEnumerator"
};
IgnoredTypes = new HashSet<string> {
"System.Threading.Tasks.Task",
}; This list is currently hard-coded, but there is a plan to make this configurable in ticket #15. For a short-term solution, I can add this interface to the hard-coded items. Is the full name |
thanks, yes, it's the full name |
I just uploaded v0.21. can you Verify the fix? |
hi, I tried on vs2015 and v2017, both looks like has the problem. still, i'm getting the warning for |
I'm still not able to reproduce the problem. But I stumbled upon the original source code, so maybe this helps to reproduce the problem. At the moment, the only difference I can see is, that the namespace from ILoggerFactory does not match its folder structure. But this should not matter at all. |
Finally I was able to reproduce the problem. There was actually a bug that causes the problem. I added a few test, so the problem should not occur any more. Will be part of release 0.33. |
this is a method that i have, using asp.net core 1.2
method is returning a disposable object that shouldn't be marked as a warning inside the method. moreover it's base asp.net core class. (this one and ILogger, for both i get this wiggly marker under them)
The text was updated successfully, but these errors were encountered: