Skip to content
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

Error information mismatch when Omnisharp begins/completes analysis #843

Closed
masaeedu opened this issue Oct 26, 2016 · 12 comments
Closed

Error information mismatch when Omnisharp begins/completes analysis #843

masaeedu opened this issue Oct 26, 2016 · 12 comments

Comments

@masaeedu
Copy link

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview2-003131)

Product Information:
 Version:            1.0.0-preview2-003131
 Commit SHA-1 hash:  635cf40e58

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64

VS Code version: Version 1.6.1
C# Extension version: 1.5.0-beta4

I'm seeing strange behavior in a multi-target project.json-based project. When hovering over a type that is available in the full framework but not available in the netstandard target, the expected popups disappear as the project transitions between "building" and "ready" states.

Steps to reproduce

There are two scenarios where I'm seeing problems. Here is the setup for both:

  1. Clone the repo: git clone git@github.com:masaeedu/language-ext.git
  2. cd language-ext
  3. Checkout demo branch: git checkout omnisharpmissingerrors
  4. Restore packages: dotnet restore

Scenario 1: Type lookup in open file as project analysis finishes

  1. Perform setup
  2. Open in VS Code: code .
  3. Type lookup: Immediately after the editor opens:
    1. Open LanguageExt.Tests/TaskTests.cs
    2. Periodically hover over the WebClient parameter type on line 78 and observe the result

Scenario 2: Type lookup in open file as project analysis begins

  1. Perform setup
  2. Open in VS Code: code .
  3. Type lookup: After the editor opens:
    1. Use "Omnisharp: Select Project" from the command palette to initialize Omnisharp with the root folder (language-ext)
    2. Wait for 1-2 minutes for everything to build successfully (this might take some trial and error)
    3. Open LanguageExt.Tests/TaskTests.cs
    4. Observe the bottom ribbon errors and the error information associated with the WebClient parameter type on line 78
    5. Make a change in an upstream project (e.g. add whitespace in LanguageExt.Core/ActionObservable.cs)
    6. Immediately afterwards, delete line 75-80 in LanguageExt.Tests/TaskTests.cs
    7. Observe the bottom ribbon errors
    8. Close and reopen LanguageExt.Tests/TaskTests.cs
    9. Observe the location of squiggly underlines in the file

Actual and expected behavior

Scenario 1

Actual

You will see a "Loading..." popup appear for a while as the project is built. After a while, hovering over the WebClient symbol will no longer display any popup at all. In the verbose log I see that a type lookup is occurring and comes up with {"Type":null,"Documentation":null}, but no errors appear.

After the "Loading..." popup stops appearing, close and reopen the file. Now the appropriate squiggles and bottom ribbon error entries appear.

Expected

Once analysis has completed, the appropriate errors should appear in the editor and the bottom ribbon automatically. The user should not have to close and reopen the file.

Scenario 2

Actual

Once you open the file after waiting an appropriate amount of time, the appropriate squiggles and bottom ribbon errors will appear correctly. After making the described changes to LanguageExt.Core/ActionObservable.cs and LanguageExt.Tests/TaskTests.cs, errors continue to appear in the bottom ribbon even though the corresponding lines have been deleted. After reopening the LanguageExt.Tests/TaskTests.cs file, error squiggles appear underneath the wrong code:

error squiggles underlining shifted code

Expected

Errors should disappear once the code is modified, pending rebuild. At the very least, error underlining should not be applied to the wrong code.

Additional improvements

When user-requested information is blocked by pending analysis, it would be nice if you could display a specific indication of what Omnisharp is doing and (where possible) how long it will take, instead of just showing the user "Loading...".

@DustinCampbell
Copy link
Member

@masaeedu: Could you try the latest v1.5-future-preview1 release? This should address a lot of the problems with blocking and waiting on the OmniSharp server.

@DustinCampbell
Copy link
Member

DustinCampbell commented Nov 15, 2016

For scenario #1: The "Loading..." should be gone with the latest release. As you deduced, there isn't a popup because 1) type lookup is failing for "WebClient", and 2) there aren't error squiggles in the file. So, technically, this scenario is working as expected. The problem is that the error squiggles aren't appearing, which is broken. It appears that the CodeCheck request made to OmniSharp never returns.

@masaeedu
Copy link
Author

masaeedu commented Nov 15, 2016

@DustinCampbell If you hover the symbol after reopening the file, an error popup does appear, despite type lookup continuing to fail. I am assuming this error popup should appear without having to close and reopen the file.

@DustinCampbell
Copy link
Member

Oh, certainly. It's definitely a bug. 😄

@DustinCampbell
Copy link
Member

#945 should address scenario 1 above.

@DustinCampbell
Copy link
Member

OK. I've prepared a new release that should at least fix scenario 1 and (hopefully) scenario 2. It'd be great if you could give it a spin before we release it to the public. Use the following steps to download and install it:

  1. Download the VSIX from here
  2. Open Visual Studio Code
  3. Select View->Extensions to display the Extensions pane.
  4. In the Extensions pane, click the little gear icon next to the C# extension and select Uninstall.
  5. Confirm any prompts and allow Visual Studio Code to reload itself.
  6. In the Extensions pane, click the [...] that appears in the top-right corner and select "Install from VSIX..."
  7. Select the VSIX you downloaded.
  8. Let Visual Studio Code reload itself.

@masaeedu
Copy link
Author

@DustinCampbell Just went through the steps and scenario 1 looks to be working.

@DustinCampbell
Copy link
Member

That's great to hear! Progress. 😄

@masaeedu
Copy link
Author

I don't know if this new machine is too fast to be able to properly repro scenario 2 or if its fixed. Not seeing the incorrect squiggles either way.

its a yes from me

@DustinCampbell
Copy link
Member

This release greatly improves communication with the OmniSharp server. In the past, it was blocking on requests, would would delay the diagnostics.

@masaeedu
Copy link
Author

Alright, well, that solves my problem. Maybe this release will also fix the disappearing dialogs problem mentioned in the other issues.

@DustinCampbell
Copy link
Member

Fantastic. I hope so too.

@DustinCampbell DustinCampbell added this to the 1.5 milestone Nov 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants