ionide / FsAutoComplete

F# language server using Language Server Protocol
Other
389 stars 151 forks source link

#r "nuget: System.Data.Common" doesn't seem to work in .fsx #1247

Open smoothdeveloper opened 3 months ago

smoothdeveloper commented 3 months ago

Version

ionide F# v7.18.2

Dotnet Info

.NET SDK: Version: 8.0.200 Commit: 438cab6a9d Workload version: 8.0.200-manifests.5638171e

Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.200\

.NET workloads installed: [android] Installation Source: VS 17.9.34622.214 Manifest Version: 34.0.79/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.79\WorkloadManifest.json Install Type: Msi

Host: Version: 8.0.2 Architecture: x64 Commit: 1381d5ebd2

.NET SDKs installed: 2.1.818 [C:\Program Files\dotnet\sdk] 3.0.103 [C:\Program Files\dotnet\sdk] 5.0.408 [C:\Program Files\dotnet\sdk] 6.0.404 [C:\Program Files\dotnet\sdk] 7.0.102 [C:\Program Files\dotnet\sdk] 8.0.100 [C:\Program Files\dotnet\sdk] 8.0.200 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.27 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

Steps to reproduce

in ionide vscode:

#r "nuget:System.Data.Common"
#r "nuget:System.Data.SqlClient"
open System.Data.SqlClient
let connectionString =
    let builder = SqlConnectionStringBuilder()
    builder.UserID <- "a"
    builder.Password <- "b"
    builder.DataSource <- @"c"
    builder.InitialCatalog <- "d"
    string builder
let connection = SqlConnection(connectionString)
//connection.Open()

gives

The type 'DbConnectionStringBuilder' is required here and is unavailable. You must add a reference to assembly 'System.Data.Common, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. F# Compiler 1108

on SqlConnectionStringBuilder

The same script works fine in VS & Rider, so I'm assuming there is something to adjust in FSAC.

Details

squiggles and unable to get tooling to work on the types such as "SqlConnectionStringBuilder".

Logs

[14:43:40 DEBUG] [LanguageService] FSAC (NETCORE): 'c:\Users\gauth.vscode\extensions\ionide.ionide-fsharp-7.18.2\bin\net7.0\fsautocomplete.dll' [14:43:40 DEBUG] [LanguageService] F# language server options: % { command: 'C:\Program Files\dotnet\dotnet.exe', args: [ 'c:\Users\gauth\.vscode\extensions\ionide.ionide-fsharp-7.18.2\bin\net7.0\fsautocomplete.dll', '--project-graph-enabled', '--verbose' ], options: { env: { ADVISOR_2023_DIR: 'C:\Program Files (x86)\Intel\oneAPI\advisor\2023.2.0', ALLUSERSPROFILE: 'C:\ProgramData', APPDATA: 'C:\Users\gauth\AppData\Roaming', APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL: '1', CHROME_CRASHPAD_PIPE_NAME: '\\.\pipe\crashpad_42604_KZWKVXHCMNJBDYZU', CLIENTNAME: 'gauthier-air', CommonPropertyBagPath: 'C:\Users\gauth\AppData\Local\Temp\csdevkit\103b7e72.json', CommonPropertyBagWithConfigPath: 'C:\Users\gauth\AppData\Local\Temp\csdevkit\e899b1d2861b1710510140710.json', COMPUTERNAME: 'P14S', ComSpec: 'C:\Windows\system32\cmd.exe', CommonProgramFiles: 'C:\Program Files\Common Files', 'CommonProgramFiles(x86)': 'C:\Program Files (x86)\Common Files', CommonProgramW6432: 'C:\Program Files\Common Files', DOTNET_ROLL_FORWARD_TO_PRERELEASE: '1', DriverData: 'C:\Windows\System32\Drivers\DriverData', EFC_10100: '1', ELECTRON_RUN_AS_NODE: '1', HOME: 'C:\Users\gauth', HOMEDRIVE: 'C:', HOMEPATH: '\Users\gauth', IFORT_COMPILER23: 'C:\Program Files (x86)\Intel\oneAPI\compiler\2023.2.0\windows\', INSPECTOR_2023_DIR: 'C:\Program Files (x86)\Intel\oneAPI\inspector\2023.2.0', I_MPI_ONEAPI_ROOT: 'C:\Program Files (x86)\Intel\oneAPI\mpi\2021.10.0', LOCALAPPDATA: 'C:\Users\gauth\AppData\Local', LOGONSERVER: '\\P14S', MSMPI_BENCHMARKS: 'C:\Program Files\Microsoft MPI\Benchmarks\', MSMPI_BIN: 'C:\Program Files\Microsoft MPI\Bin\', NUMBER_OF_PROCESSORS: '16', ONEAPI_ROOT: 'C:\Program Files (x86)\Intel\oneAPI\', ORIGINAL_XDG_CURRENT_DESKTOP: 'undefined', OS: 'Windows_NT', OneDrive: 'C:\Users\gauth\OneDrive', OneDriveConsumer: 'C:\Users\gauth\OneDrive', PATHEXT: '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC', PNPM_HOME: 'C:\Users\gauth\AppData\Local\pnpm', PROCESSOR_ARCHITECTURE: 'AMD64', PROCESSOR_IDENTIFIER: 'AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD', PROCESSOR_LEVEL: '23', PROCESSOR_REVISION: '6001', PSModulePath: 'C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft SQL Server\160\Tools\PowerShell\Modules\', PUBLIC: 'C:\Users\Public', PYTHONPATH: ';C:\work\gitsvndev\\tasks\src\python', Path: 'C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\;C:\Program Files (x86)\Intel\oneAPI\mpi\latest\bin\release\;C:\Program Files (x86)\Intel\oneAPI\mpi\latest\libfabric\bin\;C:\Program Files (x86)\Intel\oneAPI\mpi\latest\libfabric\bin\utils\;C:\Program Files (x86)\Intel\oneAPI\tbb\latest\redist\intel64\vc_mt\;C:\Program Files (x86)\Intel\oneAPI\tbb\latest\redist\ia32\vc_mt\;C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\redist\intel64_win\compiler;C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\redist\ia32_win\compiler;C:\Program Files\Microsoft MPI\Bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\TortoiseGit\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Microsoft SQL Server\160\Tools\Binn\;C:\Program Files\Microsoft SQL Server\160\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\Microsoft SQL Server\160\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\;C:\Program Files\Azure Data Studio\bin;C:\Program Files\Graphviz\bin;C:\Program Files\nodejs\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\Meld\;C:\Users\gauth\AppData\Local\pnpm;C:\Users\gauth\.cargo\bin;C:\Users\gauth\AppData\Local\Programs\Python\Python311\Scripts\;C:\Users\gauth\AppData\Local\Programs\Python\Python311\;C:\Users\gauth\AppData\Roaming\Python\Python39\Scripts;C:\Users\gauth\AppData\Local\Microsoft\WindowsApps;C:\Users\gauth\.dotnet\tools;C:\Users\gauth\AppData\Local\JetBrains\Toolbox\scripts;C:\Users\gauth\.dotnet\tools;C:\Program Files\Azure Data Studio\bin;C:\Users\gauth\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\gauth\AppData\Roaming\npm', ProgramData: 'C:\ProgramData', ProgramFiles: 'C:\Program Files', 'ProgramFiles(x86)': 'C:\Program Files (x86)', ProgramW6432: 'C:\Program Files', RPROVIDER_LOG: 'c:\tmp\rprovider.log', SESSIONNAME: 'RDP-Tcp#0', SHFBROOT: 'C:\Program Files (x86)\EWSoftware\Sandcastle Help File Builder\', SystemDrive: 'C:', SystemRoot: 'C:\Windows', TEMP: 'C:\Users\gauth\AppData\Local\Temp', TMP: 'C:\Users\gauth\AppData\Local\Temp', USERDOMAIN: 'P14S', USERDOMAIN_ROAMINGPROFILE: 'P14S', USERNAME: 'gauth', USERPROFILE: 'C:\Users\gauth', VS2019INSTALLDIR: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community', VS2022INSTALLDIR: 'C:\Program Files\Microsoft Visual Studio\2022\Community', VSCODE_AMD_ENTRYPOINT: 'vs/workbench/api/node/extensionHostProcess', VSCODE_CODE_CACHE_PATH: 'C:\Users\gauth\AppData\Roaming\Code\CachedData\863d2581ecda6849923a2118d93a088b0745d9d6', VSCODE_CRASH_REPORTER_PROCESS_TYPE: 'extensionHost', VSCODE_CWD: 'C:\Users\gauth\AppData\Local\Programs\Microsoft VS Code', VSCODE_HANDLES_UNCAUGHT_ERRORS: 'true', VSCODE_IPC_HOOK: '\\.\pipe\617e240a-1.87.2-main-sock', VSCODE_NLS_CONFIG: '{"locale":"en-us","osLocale":"en-us","availableLanguages":{},"_languagePackSupport":true}', VSCODE_PID: '42604', VTUNE_PROFILER_2023_DIR: 'C:\Program Files (x86)\Intel\oneAPI\vtune\2023.2.0', __COMPAT_LAYER: 'DetectorsAppHealth', windir: 'C:\Windows', DOTNET_ROLL_FORWARD: 'LatestMajor', DOTNET_GCNoAffinitize: 1, DOTNET_GCHeapCount: '2', DOTNET_GCConserveMemory: 0, DOTNET_GCServer: 1, FCS_ParallelReferenceResolution: 'true' } } } [14:43:42 DEBUG] [Main] Activating features [14:43:42 ERROR] [Main] Error while activating feature 'testExplorer': Error: Option has no value [14:43:42 ERROR] [Main] Error loading projects: Error: Option has no value

Checklist

TheAngryByrd commented 3 months ago

I can't seem to reproduce this. Tooltips seem to work with no errors.

smoothdeveloper commented 3 months ago

Mmh, thanks for checking, I'll try to investigate more what could be specific to my environment.

TheAngryByrd commented 3 months ago

I do see we're not passing along error messages to the LSP Client which I fixed in https://github.com/fsharp/FsAutoComplete/pull/1248 so that should give better error messages for why it's not working.

I know restores can get weird (specifically on windows) due to process locking files, so hopefully this exposes those types of errors.

smoothdeveloper commented 3 months ago

@TheAngryByrd, you know what?

#r "paket: nuget System.Data.Common"
#r "paket: nuget System.Data.SqlClient"
open System.Data.SqlClient
let connectionString =
    let builder = SqlConnectionStringBuilder()
    builder.UserID <- "a"
    builder.Password <- "b"
    builder.DataSource <- @"c"
    builder.InitialCatalog <- "d"
    string builder
let connection = SqlConnection(connectionString)

Works, that is, using the proper package manager (paket), that knows how to not get weird (specifically on windows).

The main issue is that to get it working, you have to be a ninja and copy files around on each ionide/FSAC update, or you have to promote the heretic thing: #1198 & https://github.com/ionide/ionide-vscode-fsharp/pull/1959

Heresy (towards the almighty blessed NuGet official client) is prevailing nowadays, why not giving it a shot?

🙂