opened
TeaDrivenDev
username_0
#### Repro steps

Provide the steps required to reproduce the problem

1. Create a `let` binding in F# code, leave the value unused
2. Hover over the name with the mouse pointer

#### Expected behavior

The Tooltip displays type information for the value.

![screenshot - 20170516004528](https://cloud.githubusercontent.com/assets/2247219/26082587/02f05faa-39d1-11e7-8820-b3b8b11606bc.png)

#### Actual behavior

The tooltip only says "The value is unused - Show potential fixes".

![screenshot - 20170516002837](https://cloud.githubusercontent.com/assets/2247219/26082220/291905b2-39cf-11e7-9ad7-3409450faec9.png)

#### Known workarounds

Set the caret on the name, press Ctrl-K, Ctrl-I

#### Related information 

VFT version 15.4.1.17051503
"The value is unused" tooltip hides type information
issue
created
vasily-kirichenko
username_1
@username_2 it seems tooltips are broken even in master :( @username_0 can you say in what version you saw this bug first time?
comment
created
majocha
username_2
I can't reproduce this on master :|
I'm downloading 1503 and will try.
comment
created
majocha
username_2
Can't reproduce on 1503 either. @username_0 is this occurring randomly?
comment
created
majocha
username_2
Current master:

![tooltip](https://cloud.githubusercontent.com/assets/1760221/26122477/f35e458c-3a77-11e7-8e66-30aa2fa7d87f.gif)

As can be seen, Visual Studio puts the tooltip together from various sources asynchronously. Various parts show up independently and shouldn't interfere.
If for example `getTooltipFromRange` fails or `GetItemAsync` is very late, the displayed result could be exactly as in this issue.
comment
created
TeaDrivenDev
username_0
@username_2 No, it's consistent. I don't remember ever seeing it work as in your screenshot. The type information never shows up, even on small self-contained scripts.
comment
created
TeaDrivenDev
username_0
I just checked on my other machine, and it appears to work fine there (VS 2017 Community with 17051401). It doesn't work at all on this one (VS 2017 Professional); I also suspended ReSharper (just to be sure), but that didn't change anything.
comment
created
majocha
username_2
@username_0 thanks for the follow-up. This is mysterious. I can't think of anything that would break this between 514 and 515.
comment
created
TeaDrivenDev
username_0
@username_2 It doesn't seem to be related to the versions; it still works fine on the other machine with 1604. So there appears to be something on that one system that prevents the tooltip from being updated.
comment
created
majocha
username_2
@username_0 this bug happens on a particular configuration, and only when triggered with the mouse, not the keyboard, and only when there is also a "unused value" hint?
comment
created
TeaDrivenDev
username_0
@username_2 Yes, exactly. The system in question has now updated to 1604 as well and still shows that behavior.
comment
created
majocha
username_2
Thanks, this gives me some ideas about what to look into.
comment
created
cartermp
username_3
@username_0 Can you still reproduce this?
comment
created
TeaDrivenDev
username_0
@username_3 Yes, consistently on one machine, never on the other.
comment
created
cartermp
username_3
Hmmm.  Strange, because I haven't been able to reproduce this.  One guess is that the VS install on the machine it repros on is bad.  Have you reinstalled or repaired on that machine since seeing this?
comment
created
TeaDrivenDev
username_0
I don't think I have with VS. I have likely un- and reinstalled the F# Tools several times in that time, though.
comment
created
cartermp
username_3
If you could try reinstalling VS on that machine, that would be great.  Because this is only consistent on that machine and the F# tools have been uninstalled/reinstalled there, I suspect that something went funky on the install of VS itself.
comment
created
Pilchie
username_4
Potentially a MEF ordering issue where one thing is shown on top of the other because the order is indeterminate, and usually we get lucky?
comment
created
TeaDrivenDev
username_0
If there's anything I can do give you any kind of additional diagnostic information as "patient zero", let me know.
comment
created
bentayloruk
username_5
I have the same issue originally reported by @username_0, but the workaround does not work for me because Ctrl+K+I also shows the warning only.  I can't find a way to make the type information show.  I'm running the nightly.  I've included the version information and the full VS info below.  
![f -tooltip-issue](https://user-images.githubusercontent.com/189409/32269052-32002efe-bee9-11e7-8305-601d8a93e483.gif)

![image](https://user-images.githubusercontent.com/189409/32269538-91a01dc8-beea-11e7-9d1e-69fef231a3c1.png)

<details>
<summary>Full VS Version Details</summary>
Microsoft Visual Studio Professional 2017 
Version 15.4.2
VisualStudio.15.Release/15.4.2+27004.2006
Microsoft .NET Framework
Version 4.6.01590

Installed Version: Professional

Visual Basic 2017   00369-60000-00001-AA768
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA768
Microsoft Visual C# 2017

Visual F# 4.1   00369-60000-00001-AA768
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.9.00809.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30925.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   1.0
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017   5.2.50921.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.0.30915.0
Azure App Service Tools v3.0.0

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

GhostDoc   5.4.16325.0
GhostDoc automatically generates XML documentation comments.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JetBrains ReSharper Ultimate 2017.1.2    Build 108.0.20170428.75743
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2017 JetBrains, Inc.

Microsoft Continuous Delivery Tools for Visual Studio   0.3
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Node.js Tools   1.4.10918.1
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   4.4.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

SQL Server Data Tools   15.1.61707.200
Microsoft SQL Server Data Tools

TestDriven.Net   4.0-beta3
Zero friction testing for Visual Studio

TypeScript   2.3.5.0
TypeScript tools for Visual Studio

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

VsVim   2.4.1.0
VsVim is a Vim emulator for Visual Studio
</details>
comment
created
vasily-kirichenko
username_1
Yes, I can reproduce it every time. It's super annoying.
comment
created
bentayloruk
username_5
It is.  I don't have any F# templates either for some reason.  I'm going to try a VS repair and then a re-install if the repair does not work.  I'll update with any change.
comment
created
bentayloruk
username_5
The tooltip and templates are now working for me.  I fixed it by downloading the VS2017 installer from MSDN, running it and selecting the repair option.  I then added back VsVim and the F# nightly config, updated to the latest nightly and all was working.  It also worked before going back to the nightly.
comment
created
bentayloruk
username_5
I spoke to soon.  VS was very unstable after doing the repair and the F# nightly configuration.  This specific issue was fixed, but VS started crashing when I tried to rename C# type members.  Therefore, I re-installed Visual Studio and configured nightlies again.  I now have the original issue back.  I only see **The value is unused** when hovering or doing Ctrl+K Ctrl+I.  In addition, VS still crashes when I try and rename a C# member.  So I've swapped one issue for two!  If anyone can advise me as to what I can do to help diagnose this, please let me know.
comment
created
cartermp
username_3
cc @username_4 @jinujoseph for the issue with VS crashing with Inline Rename on C# members.  That definitely doesn't seem right, and the F# nightly shouldn't be messing with that.

@username_5 If you go to VS and click the "Report a Problem" icon in the top-right and create a new issue, the Attachments tab will have an option called "record".  This will record a trace that you can send with the feedback tool, which will allow people to see what's going on.
comment
created
cartermp
username_3
Unfortunately, I still can't reproduce this :(

Using 15.5 Preview 2.
comment
created
vasily-kirichenko
username_1
@username_3 I forget when I saw both signature and "value is unused" at the same time.
comment
created
bentayloruk
username_5
@username_3 thanks for the guidance.  I've never used that feature before!

It turns out that I don't even have to try and rename the member.  I literally just have to click on the name of it and it causes a `NullReferenceException` in `Microsoft.CodeAnalysis.Workspaces`.  I've recorded the steps and submitted it [over here](https://developercommunity.visualstudio.com/content/problem/143079/visual-studio-crash-when-click-on-c-interface-memb.html). 

Is there any easy way to flip between the nightly and the latest "official" version of F# for VS?  I could try that and confirm if the issue is present when not on the nightly.
comment
created
cartermp
username_3
@username_5 Unfortunately, there's no way to toggle the version of the tools.  If you run `VSIXInstaller.exe /u:VisualFSharp` from the Visual Studio Developer Command Prompt (admin mode not required, but I do it as admin anyways) then it will uninstall the nightly release.
comment
created
bentayloruk
username_5
@username_3 The uninstall is easy enough, thanks.  I uninstalled and the crash when clicking the C# member no longer happens.  The R# dialog box pops up as expected.  I'm not sure if this confirms it's anything to do with VFT or not...
comment
created
cartermp
username_3
It definitely _shouldn't_, and I'd be shocked if it did.  Regardless, @username_15 you may want to take a look at this as well...
comment
created
RinsibleElk
username_6
I'm pretty late on this but regarding the original issue, I found that suspending Resharper didn't help, however disabling Resharper fully (and restarting VS) sorted it.
comment
created
vasily-kirichenko
username_1
@username_6 how have you managed to disable R#? I have it installed as part of R# Ultimate.
comment
created
bentayloruk
username_5
Thanks for the comment @username_6.  I've just disabled ReSharper and the original issue was resolved for me too (I can see the value is unused AND the type information for the value).  However, the crash on the C# member still happens.

@username_1 I disabled ReSharper via Tools > Extensions and Updates > Installed > All > Resharper, then click Disable and restart.
comment
created
cartermp
username_3
Just to make sure we're isolating variables here: does the issue go away if you restart VS _and_ have ReSharper active?
comment
created
bentayloruk
username_5
@username_3 not for me.  The issue remains if I restart VS *and* have R# active.
comment
created
cartermp
username_3
Thanks!  @username_7 - anyone on the JB side who might be able to see what's going on here?
comment
created
auduchinok
username_7
@username_3 Thanks for letting me know!
I've discussed the issue with a R# team member who is responsible for tooltips, we'll try to sort it out.
comment
created
auduchinok
username_7
Even though it happens when ReSharper is active, it looks like the bug is not caused by ReSharper itself but rather by just its presence in the Visual Studio component container.
ReSharper exports a class implementing `IQuickInfoSourceProvider` that may add add modify tooltips. The provider however does nothing breaking for F# files in its `AugmentQuickInfoSession`.

It looks like the actual problem is caused by `QuickInfoCommandHandlerAndSourceProvider+QuickInfoSource` that doesn't ask other providers when tooltip evaluation session (`IQuickInfoSession`) already has any element ([decompiled method](https://gist.github.com/username_7/3145e2098b64f2584fc5b6e49930ca55#file-quickinfocommandhandlerandsourceprovider-cs-L96-L97)).

How is it related? There's a sorted list of exported providers. When the ReSharper provider isn't exported `QuickInfoSource` goes before `SquiggleQuickInfoSource` in the list. When the provider is exported the order of these two is changed. Due to this the error/warning squiggle is being added before the type tooltip and then `QuickInfoSource` doesn't execute any other providers (so the type tooltip is never added).

It looks like adding `Order` attributes to these two providers in VS/Roslyn code will fix the issue.
comment
created
auduchinok
username_7
@username_3 Could someone on MS side check whether adding these attributes fixes the issue?
comment
created
cartermp
username_3
Whoops, missed this.  Thanks for getting this looked into, @username_7.

@username_4 would you know more about this?
comment
created
Pilchie
username_4
Tagging @Jinujoseph.  @Rchande probably has the most context on QuickInfo, but isn't directly working on that right now.

@username_15 has also done some stuff in the Roslyn QuickInfoProvider.
comment
created
cmeeren
username_8
I too experience the same error when R# is enabled (even if suspended). Disabling the R# plugin and restarting VS fixes the issue. See #3518.
comment
created
bentayloruk
username_5
FYI someone has added the crash that [I mention above](https://github.com/Microsoft/visualfsharp/issues/3056#issuecomment-341382016) and reported via VS, in the Roslyn repos https://github.com/dotnet/roslyn/issues/23279.
comment
created
cartermp
username_3
@username_5 looks like it was migrated over from our feedback tool, since active development for Roslyn is on GitHub.
comment
created
bentayloruk
username_5
@username_3 yes.  I don't the issue on new VM with latest VS release and F# nightly, so hopefully it's sorted.  Going to try and confirm by updating VS on my broken VM.
comment
created
urbanhop
username_9
VS 2017 with Resharper.
"The value is unused" but no type info.
Resharper disabled, no change at all.
Having no type info available for variables stops me from using VS2017.

Can I disable the whole Roslyn code fix feature from F#?
comment
created
vasily-kirichenko
username_1
@username_9 Are you sure you _disabled_ R#, not suspended?

You cannot disable the fix.
comment
created
cmeeren
username_8
I see that a few comments up, @username_5 reports not seeing "the issue". I don't know what the issue is, but just to be clear, I still experience missing tooltips when R# is enabled or suspended on VS15.5 and latest nightly.
comment
created
urbanhop
username_9
@username_1 you got me. I suspended it. How can I disable it?
comment
created
cmeeren
username_8
@username_9  In Tools -> Extensions and updates.
comment
created
urbanhop
username_9
VS2017. Resharper disabled. Still no type info. Just "The value is unused".

Any helpful information I can provide?
comment
created
vasily-kirichenko
username_1
@username_9 go to Tools -> Extensions and updates -> ReSharper, and disable it.
comment
created
cmeeren
username_8
Just to be sure that R# is disabled, open Tools -> Options and search for ReSharper. There should be no results.
comment
created
urbanhop
username_9
VS2017. Resharper disabled. Another restart of VS. **Type info is there**.
comment
created
urbanhop
username_9
Filed a bug report to Jetbrains/Resharper, citing this thread.
comment
created
cmeeren
username_8
@username_9 Could you post the link?
comment
created
urbanhop
username_9
@username_8, Jetbrains replied to me that @username_7 replied here above already.
comment
created
cartermp
username_3
Just to clarify, is this _only_ when the value is unused?
comment
created
cmeeren
username_8
I'll let @username_9 answer for themselves but I seem to experience this when there's any kind of warning or error. Simply put, if there's a squiggle (or unused), then only the error is shown and nothing else unless I completely disable R# (which is a drag in a mixed F#/C# solution).
comment
created
cartermp
username_3
I suspect that is some lower-level issue, then.  @jinujoseph is this something your team can look into?

In the meantime, #4074 should make the issue with unused names a bit easier to deal with. I think it's good to have the configuration either way.
comment
created
urbanhop
username_9
@username_3 : Yes the problem occurs **only when the value really *is* unused**. This is a big problem as I use VS to write *fresh* code (partly joking here) and fresh code *very very* frequently involves unused values. A fresh function with its signature just written certainly does not yet use the values passed in. So as long as you do not use the args you are not able to examine their type. But before using them I want to check which type they have. Not possible due to this issue.
comment
created
kkkmail
username_10
The stuff still does not work, no matter what I tried according to descriptions above!!! The stupid workaround is to "agree" to prefix unused value with the underscore and then, voila!, R# miracle happens and it is possible to see the type.
comment
created
cmeeren
username_8
Any update on this? I still have to completely disable ReSharper in order for the problem to disappear, which is a bit of a letdown to be honest, because it's great for my C# code (I have mixed C#/F# solutions).
comment
created
cartermp
username_3
No update. 15.6 will have the ability to turn off the analyzer as a workaround.
comment
created
cmeeren
username_8
Is there an issue/report anywhere else I could track?
comment
created
cartermp
username_3
Not at the moment, no. When we have the time, we can debug the editor to determine the root cause and route to the right team (or muck about with MEF ourselves if need be). But this is not a critical issue in our eyes, so there is no timeline for when that will happen.
comment
created
urbanhop
username_9
Just wanted to report back that with 

VS2017 15.5.6 
Visual F# 4.1   00369-60000-00001-AA903

unused variables are not reported as being unused, making the problem disappear on my side (Being able to inspect types during coding is more important to me than reminding me about unused vars). thx
comment
created
saul
username_11
@username_3 can we get someone from MS to take a look at this? If the Order attribute fixes this then it's a one line fix. None of the open source contributors have access to the code in question so we have our hands tied here...
comment
created
cmeeren
username_8
Any update on this? Especially considering the above comment by @username_11 that this could perhaps be a one line fix from MS if someone could just pull that string.
comment
created
realvictorprm
username_12
Pinging too, reshaped is quite much used so far I understood so possible bugs connected to it should be resolved.
comment
created
cartermp
username_3
No update at this time. QuickInfo is now fully in the editor layer, so perhaps @username_13 would know more about this: https://github.com/Microsoft/visualfsharp/issues/3056#issuecomment-343449101
comment
created
olegtk
username_13
That sounds like something @username_14 fixed recently (only one content item in QuickInfo).
comment
created
gundermanc
username_14
The issue I fixed was with multiple errors. It's possible this is an IDE bug but what I suspect is happening is that you're encountering weirdness from Roslyn's 15.7 and earlier use of the quick info APIs. If this is the case, there should be no repro in the newest F# bits because IIRC you've already switched over to the new async quick info.

Roslyn's quick info has generally required a couple of dozen milliseconds to compute and the previous generation of quick info APIs were synchronous, so to avoid UI delays, they built a state machine inside an IQuickInfoSource.

This state machine waits for the API to request items and if there are _item_ count is zero, then
comment
created
realvictorprm
username_12
@username_8 Can you check it please with the preview 15.8?
comment
created
cmeeren
username_8
Unfortunately it's not fixed in 15.8.
comment
created
auduchinok
username_7
@username_14 Have you tried adding `Order` attributes to provider types as suggested in https://github.com/Microsoft/visualfsharp/issues/3056#issuecomment-343449101 so the providers order is stable?
comment
created
cmeeren
username_8
[Repro solution.zip](https://github.com/Microsoft/visualfsharp/files/1992765/Test.zip)
comment
created
gundermanc
username_14
Took a look at the bits in the various preview builds on my box and they don't seem to contain the change to the new quick info API yet (they still use IQuickInfoProvider instead of IAsyncQuickInfoProvider):

```csharp
namespace Microsoft.VisualStudio.FSharp.Editor
{
	[ExportQuickInfoProvider("Semantic Quick Info Provider", "F#"), CompilationMapping(SourceConstructFlags.ObjectType)]
	[Serializable]
	internal class FSharpQuickInfoProvider : IQuickInfoProvider
	{
        }
}
```

@username_15 can you confirm whether or not [this change](https://github.com/Microsoft/visualfsharp/commit/a71287f96ec8709d222f13de7e67499393dec04b) has made it into any of the VS previews? I'm fairly certain it should fix this bug (see my comment above).
comment
created
saul
username_11
@username_14 as far as I'm aware, the DLLs for the tools have the commit hash in their assembly info. You can figure out whether the DLLs you're using include that commit or not that way:

![image](https://user-images.githubusercontent.com/64654/39893238-0be587a8-549b-11e8-9068-57da5a304133.png)

If you're using the nightlies, then obviously it will already contain that commit.

If you're using one of the previews, navigate to: `C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp`
comment
created
brettfo
username_15
@username_14 The async quick info changes will first appear in VS 15.8 preview 2.  If you want to use them now you can [consume the nightly packages](https://blogs.msdn.microsoft.com/dotnet/2017/03/14/announcing-nightly-releases-for-the-visual-f-tools/) which are built from `master` (which has this change).
comment
created
vasily-kirichenko
username_1
15.8 preview with R#:

![image](https://user-images.githubusercontent.com/873919/39912180-88ee963e-5506-11e8-9c81-73eaa2801833.png)

15.8 preview with R# + VFT nightly:

![image](https://user-images.githubusercontent.com/873919/39912507-a27b2562-5507-11e8-85bc-23e3051740b6.png)

So, the issue has been solved 🔥
comment
closed
cartermp
username_3
issue