False positive IDE0005 "Open declaration can be removed" when opening namespaces from some nuget packages
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
Repro solution: [Repro.zip](https://github.com/dotnet/fsharp/files/7956933/Repro.zip)
For some NuGet packages, VS (and Rider) says that there are unused opens:

If I remove any of these, compilation fails. If I reorder them, the topmost one is always OK and the other ones are marked as unused. (In more complex projects, I have seen correctly-marked-as-used opens between incorrectly-marked-as-unused opens.)
The repro contains the actual nupkg files for a few packages from our internal company feed. The repro project is configured via `nuget.config` to use these, and will automatically restore from these, using a local `packages` folder for good measure. There is AFAIK nothing non-standard in the way these are created. However, when trying to reduce the repro further, even the next small step - copying the relevant projects as-is into the solution and using the nupkg files that are generated by that build - causes the bug to go away.
Please let me know if you need the source of the packages. (They are, strictly speaking, internal company projects, but should be safe enough to publish here.)
The bug reproduces in the latest VS as well as Rider. I therefore suspect this has to do with some F# component, e.g. FCS. (I don't really know much about that ecosystem, so apologies if I'm using incorrect terms.)
Contributor guide
Assessment
This issue has not been assessed yet.