-
Notifications
You must be signed in to change notification settings - Fork 844
Closed
Milestone
Description
In Visual studio "Find usages" command does not find usages of public generic function, when one of its generic arguments is constrained by interface.
Steps to reproduce:
- Open Visual Studio 2019
- Use menu New -> Project -> Class Library (.NET Core, F#)
- Replace content of generated file Library.fs with following code:
module Module
[<Interface>]
type IValueProvider =
abstract Value: int
let getValue (valueProvider: #IValueProvider) =
valueProvider.Value
let run () =
let valueProvider = {
new IValueProvider with
member _.Value = 0 }
getValue valueProvider
- Invoke command "Find usages" from context menu for function
getValue.
Expected behavior
One usage from function run should be found
Actual behavior
No references found to getValue
Known workarounds
- Find usages manually, which is extremely inconvenient.
- Make target function private. Requires merging multiple modules in one, which is not acceptable in my case.
Related information
I was trying to solve problem of managing dependencies in functional way using approach described in article Dealing with complex dependency injection in F#. It works great for me, except for described issue, which significantly complicated navigation across code-base.
Used versions:
- Windows 10.0.17763 Build 17763
- .NET Core 3.1.6
- Visual Studio 16.6.4