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

Fix error list unification #3071

Merged
merged 16 commits into from
Aug 18, 2017
Merged

Fix error list unification #3071

merged 16 commits into from
Aug 18, 2017

Conversation

dsyme
Copy link
Contributor

@dsyme dsyme commented May 17, 2017

This fixes error list unification #3047.

See discussion on dotnet/roslyn#19561. This even appears to work for multi-line error messages (which I had expected to be problematic)

The technique is to hack the old FSharp.ProjectSystem.Base to use the Roslyn error-reporting mechanism rather than the hard-wired one there. Quite a lot of old project system code can be deleted as a result (we should probably keep deleting unused features from that code to help with the migration to http://github.com/dotnet/project-system)

This requires that Roslyn fix, so we have to see when that makes it in - hopefully soon! It is important to note that we will require the Roslyn fix to be in place, if not Visual Studio will crash when it hits the call to FailFast mentioned in that Roslyn thread.

Separately this makes the Symbol API's EnclosingEntity return an option, I may factor that out into a separate PR

To consider (I don't think these are blocking)

  • manual stress testing with many errors etc (though the fix would always be with Roslyn, and we can probably assume that this is working ok)
  • consider re-enabling the automated tests in vsintegration/tests/unittests/Tests.TaskReporter.fs, which were effectively disabled (they were testing unused functionality) and are new fully disabled (since part of that functionality has now been replaced in ProjectSystem.Base), though this would effectively be re-testing Roslyn's logic in a somewhat unconvincing way.

@dsyme
Copy link
Contributor Author

dsyme commented May 17, 2017

I wanted to add @saul and @srivatsn as reviewers here but for some reason they aren't selectable - @KevinRansom do we have to add them as project collaborators?

Copy link
Contributor

@saul saul left a comment

Choose a reason for hiding this comment

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

Looks good - I love seeing huge swathes of code deleted! 😄 Just got a few comments.

@@ -43,7 +43,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<VSRootSuffix>FSharpDev</VSRootSuffix>
<VSRootSuffix>RoslynDev</VSRootSuffix>
Copy link
Contributor

Choose a reason for hiding this comment

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

Whoa this is wrong! Or we could merge FSharpDev with RoslynDev? I'm not massively fussed - it will help with cross-project dev.

@@ -43,7 +43,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<VSRootSuffix>FSharpDev</VSRootSuffix>
<VSRootSuffix>RoslynDev</VSRootSuffix>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

@@ -112,16 +112,16 @@ type FSharpChecker with
if func.IsProperty then
let fullNames =
[| if func.HasGetterMethod then
yield func.GetterMethod.EnclosingEntity.TryGetFullName()
yield func.GetterMethod.EnclosingEntity.Value.TryGetFullName()
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure this isn't going to blow up?

// remove all Project System tasks from the task list, add everything else to the task set
taskReporter.ClearAllTasks();
if (errorReporter != null) {
//UIThread.Run(delegate ()
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to run on the UI thread? Can this comment be removed?

{
this.taskProvider.Tasks.Add(task);
errorReporter.ReportError2(taskText, errorCode, (VSTASKPRIORITY) priority, span.iStartLine, span.iStartIndex, span.iEndLine, span.iEndIndex, file);
Copy link
Contributor

Choose a reason for hiding this comment

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

How are warnings handled? I'm not even sure that warnings show in the Error List anyway - just something to consider.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "priority" indicates information/warning/error. I'll add a note to double check once the roslyn fix is in

@@ -382,16 +399,16 @@ namespace rec Microsoft.VisualStudio.FSharp.ProjectSystem
member this.GetMostRecentLines(n:int) : string[] =
GetToolWindowAsITestVFSI().GetMostRecentLines(n)

// Can we get rid of this now?
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're not calling anything here, then yes, this can go. Same with the registration for this IOleComponent

@@ -182,807 +182,5 @@ internal static void DoOnUIThread(Action callback)
}
}

// DocumentTask is associated with an IVsTextLineMarker in a specified document and
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we rename this file to UIThread.cs now that it only contains the UIThread class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't touch the old project system code except to delete stuff

@dsyme
Copy link
Contributor Author

dsyme commented May 18, 2017

OK, all reviewed. Now this just sits around until the Roslyn fix is available :)

@dsyme
Copy link
Contributor Author

dsyme commented May 18, 2017

An odd error in CI, seems unrelated

1) Failed : Tests.ProjectSystem.Project.RenameFile.BuildActionIsResetBasedOnFilenameExtension
no exception expected, but got System.InvalidOperationException: The service 'Microsoft.Internal.VisualStudio.Shell.Interop.SVsUIThreadInvokerPrivate' must be installed for this feature to work.  Ensure that this service is available. HRESULT = 0x8000FFFF
   at Microsoft.VisualStudio.Shell.ThreadHelper.GetInvoker()
   at Microsoft.VisualStudio.Shell.ThreadHelper.InvokeOnUIThread(InvokableBase invokable)
   at Microsoft.VisualStudio.Shell.ThreadHelper.Invoke(Action action)
   at Microsoft.VisualStudio.FSharp.ProjectSystem.FileNode.PromptYesNoWithYesSelected(String message, String title, OLEMSGICON icon, IVsUIShell uiShell) in D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\src\FSharp.ProjectSystem.Base\Project\FileNode.cs:line 351
   at Microsoft.VisualStudio.FSharp.ProjectSystem.FileNode.SetEditLabel(String label) in D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\src\FSharp.ProjectSystem.Base\Project\FileNode.cs:line 342
   at <StartupCode$VisualFSharp-Unittests>.$Tests.ProjectSystem.Project.RenameFile-BuildActionIsResetBasedOnFilenameExtension@802.Invoke(UnitTestingFSharpProjectNode project) in D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\tests\unittests\Tests.ProjectSystem.Project.fs:line 812
at <StartupCode$VisualFSharp-Unittests>.$Tests.ProjectSystem.Project.RenameFile-BuildActionIsResetBasedOnFilenameExtension@802.Invoke(UnitTestingFSharpProjectNode project) in D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\tests\unittests\Tests.ProjectSystem.Project.fs:line 814
at <StartupCode$VisualFSharp-Unittests>.$TestLib.ProjectSystem.MakeProjectAndDoWithProjectFileAndConfigChangeNotifierDispose@311.Invoke(String file) in D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\tests\unittests\TestLib.ProjectSystem.fs:line 323
at UnitTests.TestLib.Utils.FilesystemHelpers.DoWithTempFile[a](String filename, FSharpFunc`2 f) in D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\tests\unittests\TestLib.Utils.fs:line 73
at UnitTests.TestLib.ProjectSystem.TheTests.MakeProjectAndDoWithProjectFileAndConfigChangeNotifierDispose[d](Boolean dispose, FSharpList`1 compileItems, FSharpList`1 references, String other, String targetFramework, FSharpFunc`2 f) in D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\tests\unittests\TestLib.ProjectSystem.fs:line 311
at UnitTests.TestLib.ProjectSystem.TheTests.MakeProjectAndDoWithProjectFile(FSharpList`1 compileItems, FSharpList`1 references, String other, String targetFramework, FSharpFunc`2 f) in D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\tests\unittests\TestLib.ProjectSystem.fs:line 340
at UnitTests.TestLib.ProjectSystem.TheTests.MakeProjectAndDo(FSharpList`1 compileItems, FSharpList`1 references, String other, String targetFramework, FSharpFunc`2 f) in D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\tests\unittests\TestLib.ProjectSystem.fs:line 351
at Tests.ProjectSystem.Project.RenameFile.BuildActionIsResetBasedOnFilenameExtension() in D:\j\workspace\release_ci_pa---3f142ccc\vsintegration\tests\unittests\Tests.ProjectSystem.Project.fs:line 802

@saul
Copy link
Contributor

saul commented Jun 14, 2017

@dsyme any update on this? This should be available in Roslyn binaries

@dsyme
Copy link
Contributor Author

dsyme commented Jun 15, 2017

@saul I will get back to it. I've been away at a conference this week and I'll get back into engineering mode over the next few working days

If you would like to finish it off please send an additional PR based on Pilchie's option #2 here: #3047 (comment)

@dsyme
Copy link
Contributor Author

dsyme commented Jun 22, 2017

@saul I will leave it up to @brettfo as to whether we integrate in 15.3 branch or not. I'd like to but only very few fixes are being taken in that branch right now

If it doesn't go into that branch then as soon as 15.3 is out we will update master to use the right 15.3 Roslyn binaries. Then we can go ahead and pull this.

@dsyme
Copy link
Contributor Author

dsyme commented Jun 22, 2017

@dotnet-bot test Windows_NT Release_ci_part2 Build please

@brettfo
Copy link
Member

brettfo commented Jun 22, 2017

@saul and @dsyme: Due to changing APIs, master has to target Roslyn 2.0 until 15.3 ships (as RTW, not a preview), but vs2017-rtm is currently targeting 15.3. Once 15.3 ships then vs2017-rtm will be merged back into master, so this PR can either be retargeted to vs2017-rtm and merged today-ish or we can wait until 15.3 ships (and vs2017-rtm merges back into master).

We try to not get into tight spots like this, but due to VS 15.0, 15.1, and 15.2 all reporting assembly versions of 15.0 and 15.3 reporting 15.3, we're in this mess.

@dsyme
Copy link
Contributor Author

dsyme commented Jun 22, 2017

@brettfo It your call with @cartermp in the end (and may depend on whether we need to take it to VS ship room to get permission).

Ideally this fix would go into 15.3 but the problem is that I can't validate the fix as I don't have a 15.3 on any machine (and I'm not sure getting 15.3.preview2 would help - I really need 15.3 preview 3)

@dsyme
Copy link
Contributor Author

dsyme commented Jul 7, 2017

This is ready once we can assume 15.3

@NatElkins NatElkins mentioned this pull request Jul 10, 2017
@cartermp
Copy link
Contributor

If we get this into 15.3, we'll have to roll it up with changes to the language service as a high-priority bug fix. Otherwise, this would have to go out via nightlies and later, 15.4. @Pilchie your thoughts?

@KevinRansom
Copy link
Member

@cartermp the bar for 15.3 is "astronomical", which I take to mean as I can't even imagine what would qualify :-)

But @Pilchie tells me that we can get this into 15.4 without too much of a tussle.

@dsyme dsyme changed the title [WIP] Fix error list unification (requires roslyn fix) Fix error list unification Aug 17, 2017
@dsyme
Copy link
Contributor Author

dsyme commented Aug 17, 2017

Now that 15.3 is out and master is using the fixed Roslyn binaries I've removed the WIP tag and I believe this is ready for commit

However we should re-check that it fixes the error list problem and that no new problems have been introduced

@cartermp
Copy link
Contributor

@dsyme I get this assertion when opening VisualFSharp.sln with your PR after a build vs:

assertion-open-dsyme-pr-el

This is for FSharp.Compiler.Interactive.Settings, as that was the only project which failed to load after ignoring assertions

@dsyme
Copy link
Contributor Author

dsyme commented Aug 17, 2017

That will be related to #3393 . What happens if you ignore the assert?

@cartermp
Copy link
Contributor

I see. It's fine and the PR will build without that project. I cannot reproduce #3047 with this PR. I'm psuedo-randomly screwing around with code in Paket to see how it reacts. Nice and clean!

clean

@dsyme
Copy link
Contributor Author

dsyme commented Aug 17, 2017

@cartermp Thank you so much for doing that validation.

@KevinRansom This is good to merge now

@dsyme
Copy link
Contributor Author

dsyme commented Aug 18, 2017

Since @cartermp has validated this, I'm going to pull it.

@dsyme dsyme merged commit 8c44f0c into dotnet:master Aug 18, 2017
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Jan 26, 2022
* try use roslyn build error reporter

* undo changes

* undo changes

* undo changes

* try use roslyn build error reporter

* more work on unifying diagnostics

* minimize diff

* bang bang

* code review feedback

* remove old test
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.

6 participants