Skip to content

Fix error list unification - #3071

Merged
dsyme merged 16 commits into
dotnet:masterfrom
dsyme:eld
Aug 18, 2017
Merged

dsyme merged 16 commits into
dotnet:masterfrom
dsyme:eld

Conversation

@dsyme

@dsyme dsyme commented May 17, 2017 •

Copy link
Copy Markdown
Contributor

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

dsyme commented May 17, 2017

Copy link
Copy Markdown
Contributor Author

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?

@saul saul 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 good - I love seeing huge swathes of code deleted! 😄 Just got a few comments.

<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<VSRootSuffix>FSharpDev</VSRootSuffix>
<VSRootSuffix>RoslynDev</VSRootSuffix>

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.

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

<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<VSRootSuffix>FSharpDev</VSRootSuffix>
<VSRootSuffix>RoslynDev</VSRootSuffix>

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.

Same here

let fullNames =
[| if func.HasGetterMethod then
yield func.GetterMethod.EnclosingEntity.TryGetFullName()
yield func.GetterMethod.EnclosingEntity.Value.TryGetFullName()

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.

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
Copy Markdown
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?

if (errorReporter != null)
{
this.taskProvider.Tasks.Add(task);
errorReporter.ReportError2(taskText, errorCode, (VSTASKPRIORITY) priority, span.iStartLine, span.iStartIndex, span.iEndLine, span.iEndIndex, file);

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.

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

Copy link
Copy Markdown
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

member this.GetMostRecentLines(n:int) : string[] =
GetToolWindowAsITestVFSI().GetMostRecentLines(n)

// Can we get rid of this now?

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.

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

}
}

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

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.

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

Copy link
Copy Markdown
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

dsyme commented May 18, 2017

Copy link
Copy Markdown
Contributor Author

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

@dsyme

dsyme commented May 18, 2017

Copy link
Copy Markdown
Contributor Author

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

saul commented Jun 14, 2017

Copy link
Copy Markdown
Contributor

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

@dsyme

dsyme commented Jun 15, 2017

Copy link
Copy Markdown
Contributor Author

@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

dsyme commented Jun 22, 2017

Copy link
Copy Markdown
Contributor Author

@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

dsyme commented Jun 22, 2017

Copy link
Copy Markdown
Contributor Author

@dotnet-bot test Windows_NT Release_ci_part2 Build please

@brettfo

brettfo commented Jun 22, 2017

Copy link
Copy Markdown
Member

@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

dsyme commented Jun 22, 2017 •

Copy link
Copy Markdown
Contributor Author

@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

dsyme commented Jul 7, 2017

Copy link
Copy Markdown
Contributor Author

This is ready once we can assume 15.3

@NatElkins NatElkins mentioned this pull request Jul 10, 2017
@cartermp

Copy link
Copy Markdown
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
Copy Markdown
Contributor

@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

dsyme commented Aug 17, 2017

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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

dsyme commented Aug 17, 2017

Copy link
Copy Markdown
Contributor Author

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

@cartermp

Copy link
Copy Markdown
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

dsyme commented Aug 17, 2017

Copy link
Copy Markdown
Contributor Author

@cartermp Thank you so much for doing that validation.

@KevinRansom This is good to merge now

@dsyme

dsyme commented Aug 18, 2017

Copy link
Copy Markdown
Contributor Author

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