Skip to content

Fix build errors not being shown in the Error List - #2839

Merged
KevinRansom merged 9 commits into
dotnet:masterfrom
saul:2548-show-build-errors
Apr 25, 2017
Merged

KevinRansom merged 9 commits into
dotnet:masterfrom
saul:2548-show-build-errors

Conversation

@saul

@saul saul commented Apr 12, 2017

Copy link
Copy Markdown
Contributor

Fixes #2548

This was happening because we were trying to get IOleComponentManager too eagerly. I think something must have changed in the ordering of MEF services in VS 2017 as at project package instantiation (before Initialize is called), the service is null.

This change makes the lookup of IOleComponentManager lazy, and I've added an assertion to make sure this is caught in future instead of being silently swallowed.

I've also made some steps towards making the errors that IntelliSense returns and the errors that VS build returns be exactly the same. For example, ensuring that we're consistent in our line endings for multi-line error/warning messages.

Unfortunately this still hasn't triggered Roslyn to merge our IntelliSense and Build Errors, even when they're exactly the same error. See the screenshot below. I will ping @heejaechang when he is back in the office next week as supposedly he is more familiar with the de-duplication logic in the Error List.

image

@cartermp

cartermp commented Apr 12, 2017 •

Copy link
Copy Markdown
Contributor

@Pilchie since Heejae is OOF, is there someone else who may be able to unblock @saul here?

@saul

saul commented Apr 12, 2017 •

Copy link
Copy Markdown
Contributor Author

@cartermp don't block this PR on the errors being de-duplicated - I'm pretty sure this is now on parity with VS 2015. I'll open a separate issue for getting them de-duplicated once this is merged.

@KevinRansom

Copy link
Copy Markdown
Contributor
  D:\j\workspace\release_ci_pa---3f142ccc\src\fsharp\CompileOps.fs(1428,5): error FS0034: Module 'Microsoft.FSharp.Compiler.CompileOps' 

contains�
    val internal OutputPhasedDiagnostic<'a> : errorStyle:'a -> os:StringBuilder -> err:PhasedDiagnostic -> flattenErrors:bool -> unit

but its signature specifies
    val internal OutputPhasedDiagnostic : ErrorStyle -> StringBuilder -> PhasedDiagnostic -> isError:bool -> unit

The respective type parameter counts differ 

[D:\j\workspace\release_ci_pa---3f142ccc\src\fsharp\FSharp.Compiler-proto\FSharp.Compiler-proto.fsproj]

@saul

saul commented Apr 12, 2017

Copy link
Copy Markdown
Contributor Author

Thanks @KevinRansom - I've pushed a potential fix. However I'm struggling to get builds working locally at the minute. I keep getting:

FSC : error FS0193: The module/namespace 'Microsoft.FSharp.Core' from compilation unit 'FSharp.Core' did not contain the namespace, module or type 'string' [C:\Code\visualfsharp\src\fsharp\FSharp.Core\FSharp.Core.fsproj]

Does this look familiar?

@dsyme

dsyme commented Apr 12, 2017

Copy link
Copy Markdown
Contributor

@cartermp don't block this PR on the errors being de-duplicated - I'm pretty sure this is now on parity with VS 2015.

I do know that VS2010-2015 all did de-duplication - they called it "Error List Unification" or something. I wasn't involved in the implementation.

But I don't know anything about how to achieve this with Roslyn.

cheers!

@cartermp

Copy link
Copy Markdown
Contributor

Calling @vladima as a shot in the dark to see if someone knows 😄

@dsyme

dsyme commented Apr 13, 2017

Copy link
Copy Markdown
Contributor

FSC : error FS0193: The module/namespace 'Microsoft.FSharp.Core' from compilation unit 'FSharp.Core' did not contain the namespace, module or type 'string' [C:\Code\visualfsharp\src\fsharp\FSharp.Core\FSharp.Core.fsproj]

I saw this. I think I rebuilt "proto" and it went away. But i don't understand why we would be getting this error.

@saul

saul commented Apr 13, 2017

Copy link
Copy Markdown
Contributor Author

I'm more concerned that the CI is failing with an error that I can't reproduce locally :/

@dotnet-bot test this please

@cartermp

Copy link
Copy Markdown
Contributor

@dotnet-bot test this please

Yeah @saul I don't know what's up. Jenkins says no identified problem...

@saul

saul commented Apr 15, 2017

Copy link
Copy Markdown
Contributor Author

Okay the remaining failures are because the suggested errors are no longer collapsed in --vserrors mode. I'll get onto fixing these tests

@heejaechang

heejaechang commented Apr 17, 2017 •

Copy link
Copy Markdown

this is de-duplication done by Roslyn? the error from build doesn't have error code, so, I am not sure how Roslyn will do de-duplication?

@saul

saul commented Apr 17, 2017

Copy link
Copy Markdown
Contributor Author

@heejaechang there's no way to supply the error code with DocumentTask. It's worth pointing out that the de-duplication worked in VS 2015 and prior.

See IDEBuildLogger.cs for where the project system passes build errors to the platform.

@heejaechang

Copy link
Copy Markdown

@saul is VS 2015 and prior used Roslyn? at the time, they might have their own way to do so, but Roslyn uses error code as one of way to do de-duplication. so without it, I dont think it will work.

@heejaechang

Copy link
Copy Markdown

@KevinRansom @brettfo who should I talk about these issue? need to know how fsharp build errors are flown into Roslyn to see how we can do proper de-duplication.

@saul

saul commented Apr 17, 2017

Copy link
Copy Markdown
Contributor Author

@heejaechang I can answer that. F# build errors are passed to the IDE via the ErrorListProvider, which is wrapped by a Microsoft.VisualStudio.Shell.TaskProvider. See DocumentTask.cs@506 in the F# code.

I think the correct solution for this is to move over to Roslyn's ProjectExternalErrorReporter. We currently don't report any errors through this, but this class implements IVsLanguageServiceBuildErrorReporter2 so we can report build errors through the ReportError2 method. This is what the Roslyn project system does.

@saul

saul commented Apr 24, 2017

Copy link
Copy Markdown
Contributor Author

@dsyme @brettfo How do I change the FSharpQA tests to test for multiline errors? It looks like the test runner is making the regexes match the whole line.

@saul

saul commented Apr 24, 2017

Copy link
Copy Markdown
Contributor Author

@cartermp @KevinRansom this is now green :) I'll raise a ticket for fixing the duplication once this is merged

@cartermp

Copy link
Copy Markdown
Contributor

@saul I'm away from my machine at the moment; do the changes to error messages change lightbulb behavior for misspelled tokens?

@saul

saul commented Apr 24, 2017 •

Copy link
Copy Markdown
Contributor Author

@cartermp no, the errors reported via the compiler when --vserrors is supplied (like when you do Build Solution in the IDE) have been made so that they match the errors reported via IntelliSense. Lightbulb fixes are unaffected, this is just a step towards being able to unify the errors reported by IntelliSense and the compiler in the Error List.

@cartermp

Copy link
Copy Markdown
Contributor

Makes sense. Was just curious since you touched the error message files themselves. I'll try this out tonight, but otherwise this all looks good.

@cartermp cartermp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like my concerns weren't necessary. Good work!

@dsyme

dsyme commented Apr 24, 2017

Copy link
Copy Markdown
Contributor

@saul @cartermp Slightly off topic: I was using the latest nightly and for the first time with VS2017 saw some issues where error messages weren't appearing in the error list, (and no red suigglies) for some files that definitely contained errors. Strangely quickinfo and autocompelte were still correct and updating, which made it feel like some problem with processing diagnostics Perhaps fixed by this PR< perhaps not.

I figured I should mention it so we can keep an eye out for problems.

@KevinRansom
KevinRansom merged commit ce473dd into dotnet:master Apr 25, 2017
@BentTranberg

BentTranberg commented Apr 25, 2017 •

Copy link
Copy Markdown

Some observations that will perhaps be of help while verifying any fix.

I have been running VS 2017 on an Intel NUC D54250WYK from the day of release, and that's not a particularly powerful machine. I have been thinking that perhaps this makes it easier to observe these problems. Perhaps the Intellisense has low priority, and tends to loose the races on a less powerful machine. Just a thought.

As I have previously reported in #2548, the situation on my machine has been hugely improved from around one month ago, and has been negligible since then. However, I did see something remarkable last week (Thursday at the earliest I believe) when I started to slash source away in huge chunks from the big solution I am working on, in order to create a minimal repro for another issue here. That turned out to be an incredibly effective way to provoke #2839 (this) and #2548. It was as bad as day one, with hundreds of errors and warnings being there when they shouldn't or vice versa. Some went away given a few minutes, and some just stuck until the solution was reopened. Have also observed the same on lesser scale earlier.

UPDATE: I thought I would have to wait until tomorrow at least, for a fix, but I am already unable to reproduce what I have described above. Visual F# Nightly 15.4.1.17042401 and VS 15.1 (26403.7)

@dsyme

dsyme commented Apr 25, 2017

Copy link
Copy Markdown
Contributor

Just to say I've been using the nightly (from two days ago) on FSharp.sln and the error list has some severe problems - lots of errors and red-squigglies were missing (intellisense errors, not build errors - I wasn't building from the IDE).

I'm not sure if it will improve with this PR or if it is orthoginal. Will try the new nightly with this change when it is avaiable

@cartermp

Copy link
Copy Markdown
Contributor

I've noticed that as well. It appears at the very top of the file.

@cartermp

cartermp commented Apr 25, 2017 •

Copy link
Copy Markdown
Contributor

e.g., in Salsa.fs:

Problem reading assembly 'C:\repos\visualfsharp\Debug\net40\bin\FSharp.ProjectSystem.FSharp.dll': Build was not evaluated, expected the results to be ready after 'Eval' (GetCheckResultsAndImplementationsForProject, data = ("FinalizeTypeCheck", [|Id 1063; Id 1064; Id 1065; Id 1066; Id 1067|], Id 1069,
 false, None))

@dsyme dsyme mentioned this pull request Apr 26, 2017
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Jan 26, 2022
* Delay GetService of IOleComponentManager

Fixes dotnet#2548

* Remove error style from OutputPhasedDiagnostic/OutputPhasedErrorR

* Fix another reference to OutputPhasedDiagnostic

* Fixed more references

* Updated error baselines to fix tests

* Fix FSharpQA errors

* Fix FSharpQA tests (again)

* Fix error spans in FSharpQA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants