dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.9k stars 783 forks source link

Is running VisualFSharpFull still supported? Several errors when running it after clean build. #13707

Closed abelbraaksma closed 2 years ago

abelbraaksma commented 2 years ago

It's been over a year that I tried this, but, at least for me, it doesn't work out of the box. Before I'm going to try to debug what's going on, let me first ask the simple question: is running / debugging from VisualFSharpFull in the VisualFSharp.sln still supported?

Repro steps

  1. Checkout latest main
  2. Ensure clean (git clean -xdf)
  3. Run build.cmd
  4. Open VisualFSharp.sln
  5. Select Release, then Build
  6. Click Debug -> Run (or Ctrl+F5)
  7. Wait until new Visual Studio opens
  8. Select any existing F# project

Expected behavior

It should "just work".

Actual behavior

Receiving a couple of those:

image

And after clicking each away, it shows this on top, clicking Reload projects has no effect:

image

Known workarounds

I'd like to hear them!

Related information

Also tried:

Each of the above leads to load errors.

Log

The Activity Log shows a bunch of warnings like this:

The term 'ProjSelected' for the UI context 5d0ad025-3bf2-4260-bdb9-8e320ffa4b1e is not referenced in the expression '( (AspNetCore & TargetsDotNetCore) | (AzureFunctions & TargetsDotNetCore) | (CSharp & CrossPlatformExecutable & !WindowsForms & !WPF) | (VB & CrossPlatformExecutable & !WindowsForms & !WPF) | (CSharp & WebProject) | (VB & WebProject) ) & SolutionExistsAndNotBuildingAndNotDebugging & !WebAssembly'. This term will be ignored.

This:

Request for "Microsoft.VisualStudio.Shell.Internal.SettingsManager (1.0)" from Process denied because the service is only exposed RemoteExclusiveClient, LiveShareGuest. Request for proxy to "Microsoft.VisualStudio.Shell.Internal.SettingsManager (1.0)" is declined: ServiceAudienceMismatch.

This:

About to block on async service creation because the service was requested via GetService. This has the potential to deadlock. Async initializing services should be retrieved via GetServiceAsync.

Errors on IntelliCode and FSharp.Editor.dll:

Still unable to load MEF component DLL: Could not load file or assembly 'Microsoft.VisualStudio.VC.RecommendationProvider, Version=17.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\EXTENSIONS\Microsoft\IntelliCode\IntelliCodeCpp.dll Still unable to load MEF component DLL: Could not load file or assembly 'Microsoft.CodeAnalysis.Workspaces, Version=4.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. c:\users\abel\appdata\local\microsoft\visualstudio\17.0_99cd9cf1roslyndev\extensions\microsoft.visualfsharptools\visual f# tools\42.42.42.4242424\FSharp.Editor.dll

And this big one, suggesting there's an assembly load error with LanguageServices for F#:

CreateInstance failed for package [FSharpPackage]Source: 'mscorlib' Description: Could not load file or assembly 'Microsoft.VisualStudio.LanguageServices, Version=4.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.LanguageServices, Version=4.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.VisualStudio.LanguageServices, Version=4.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark) at System.Activator.CreateInstance(String assemblyName, String typeName) at System.AppDomain.CreateInstance(String assemblyName, String typeName) WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

The VS load log shows many of the following errors repeated (probably once for each project in the solution I'm trying to open):

=====================
8/17/2022 12:15:47
LimitedFunctionality
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
   at Microsoft.VisualStudio.Shell.Interop.IVsTaskBody.DoWork(IVsTask pTask, UInt32 dwCount, IVsTask[] pParentTasks, Object& pResult)
   at Microsoft.VisualStudio.Services.VsTask.<>c__DisplayClass86_0.<GetCallbackForMultipleParent>b__0(Task`1[] _)
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)
   at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.CPS.CPSProjectFactory.<CreateProjectContextAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.LanguageServices.WorkspaceProjectContextProvider.<CreateProjectContextHandlingFaultAsync>d__7.MoveNext()
vzarytovskii commented 2 years ago

Yep, latest preview is needed for now unfortunately. We had to update packages to support some latest scenarios. We should've done it in 17.4 branch, but unfortunately did it in main.

abelbraaksma commented 2 years ago

I don't really mind having to download latest preview, but can that not be enforced? It's kind of surprising this way (even more so for newcomers to F# compiler & tools). Something like "Hey, you need VS 2099 for running these features"?

At the very least I can update the devguide.md, didn't find this there.

I'll try with latest preview.

abelbraaksma commented 2 years ago

PS: we are talking about this, right? https://visualstudio.microsoft.com/vs/preview/.

vzarytovskii commented 2 years ago

I don't really mind having to download latest preview, but can that not be enforced? It's kind of surprising this way (even more so for newcomers to F# compiler & tools). Something like "Hey, you need VS 2099 for running these features"?

At the very least I can update the devguide.md, didn't find this there.

We hoped to "stabilize" requirements after we released .NET 7, since now they will be changing rapidly - we need to be testing new framework and VS quite often till release in the autumn.

PS: we are talking about this, right? visualstudio.microsoft.com/vs/preview.

Yep, latest 17.4 preview

dsyme commented 2 years ago

Separately, I just got these errors on a clean build of main with the MS internal preview

C:\Program Files\Microsoft Visual Studio\2022\Internal Preview\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGe
t.targets(132,5): error : The folder 'C:\Users\dsyme\.nuget\packages\fscheck\lib' contains an invalid version. [
C:\GitHub\dsyme\fsharp\VisualFSharp.sln]
C:\GitHub\dsyme\fsharp\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj : error Undefined: The folder 'C
:\Users\dsyme\.nuget\packages\fscheck\lib' contains an invalid version.
C:\GitHub\dsyme\fsharp\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj : error Undefined: The folder 'C
:\Users\dsyme\.nuget\packages\fscheck\lib' contains an invalid version.
C:\GitHub\dsyme\fsharp\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj : error Undefined: The folder 'C
:\Users\dsyme\.nuget\packages\fscheck\lib' contains an invalid version.
C:\GitHub\dsyme\fsharp\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj : error Undefined: The folder 'C
:\Users\dsyme\.nuget\packages\fscheck\lib' contains an invalid version.
    0 Warning(s)
    5 Error(s)
vzarytovskii commented 2 years ago

Hm, seems like related to this PR: https://github.com/dotnet/fsharp/pull/13687, let me see if I can reproduce it. @dsyme out of curiosity, if you remove the FsCheck from the nuget cache - will it build?

vzarytovskii commented 2 years ago

It seems to be working on the latest preview for me. But I didn't have this version of the FsCheck installed before. Interesting.

vzarytovskii commented 2 years ago

Both VisualFSharpFull and VisualFSharpDebug work for me in the latest 17.4

abelbraaksma commented 2 years ago

Yeah, works for me again as well. From time to time, it appears I need to update the dotnet SDK and/or the CLR or something, which makes sense, I guess. Not sure that was the cause here, but either way, all's well that ends well :).