-
Notifications
You must be signed in to change notification settings - Fork 29
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
False positive "Pulse Resource Leak" when storing data in collections #221
Comments
There are some false positives for resource leaks like this (and some others) as well as for null dereferences (i.e. some kinds of Assert statements) which still occur and which I will address in the next release. It has to do with how certain language specific libraries/objects are modeled by the Infer analysis. Thanks for raising this! |
I'm also getting a false positive for an IDisposable implementation. I use the action to incorporate analysis into my Git CI. I've been trying to avoid the analysis on the file hosting the affected code, while also allowing the action to continue failing on finding any other issues. For this, I give the following flags in the action's
Git action logs show the following:
Interestingly, the file continues to be pulled into the analysis and upon analysis, the false-positive fails my CI. I'm at a loss for why this is happening. Any advice? |
Hi Christopher, I'm not too surprised that this isn't working for you given that Infer# works on compiled DLLs/PDBs, as opposed to Java for example where Infer is run as part of the build from the source code. I think I need to hack this a bit to get this to work for .NET, which hopefully is not too hard. As a short term mitigation, one thing you could do if it isn't too aggressive is to just exclude the DLL which the file was built into. This would of course also potentially create some false negatives because you would exclude analysis of more than just the file, but it can be a short-term mitigation while I look into a better solution for you. Matthew |
Hi Christopher, I just wanted to update you on this topic. Recently a new flag was added to Infer that enables you to pass an offline list of issues that you want to suppress: Does this look like it would address your situation? If so I can pull the latest binaries and create an updated release. Matthew |
Hi @matjin, I had a look at the commit you linked and it sounds promising, not only for myself but for others that have commented on the lack of suppression configuration for this tool. Chris |
Found the core issue in a real codebase and made this minimal repo case from it so that this is more convenient to reproduce
I think that Infer-sharp is loosing the reference when it get's stored in the
m_objects
array. Changingm_objects
fromReader[]
toList<Reader>
doesn't make a difference and storing as anIDisposable
rather than theReader
type also doesn't matter. TheReader
is just there to represent a Disposable, in real life this would be something more important like aStreamReader
.Am I just missing something obvious or is this a bug in the C# translation layer?
The text was updated successfully, but these errors were encountered: