dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 672 forks source link

File watcher doesn't start #7018

Closed GiedriusT closed 6 months ago

GiedriusT commented 6 months ago

Type: Bug

Issue Description

File watcher functionality is not working. I use C# extension as part of set-up for Unity. It is installed automatically when installing visualstudiotoolsforunity.vstuc and I suppose the functionality to recompile assets on file save relies on functionality provided by C# extension. When I open VSCode "Help > Toggle Developer Tools" console I see the message:

ERR MainThreadFileSystemEventService#$watch(): failed to stat a resource for file watching (extension: ms-dotnettools.csharp, path: file:///c:/Users/Giedrius/AppData/Roaming/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/8.0.3\~x64/packs/, recursive: true, session: 0.767841851414421): EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, stat 'c:\Users\Giedrius\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime.dotnet\8.0.3~x64\packs'

I tried uninstalling all C# and Unity related extensions and then install them again, but it didn't help.

Steps to Reproduce

  1. Install Unity (visualstudiotoolsforunity.vstuc) extension that will automatically install C# extension.
  2. Go to settings of Unity extension and click on Refresh on save checkbox.
  3. Go to VSCode Help > Toggle Developer Tools and Console. The error message appears:

    ERR MainThreadFileSystemEventService#$watch(): failed to stat a resource for file watching (extension: ms-dotnettools.csharp, path: file:///c:/Users/Giedrius/AppData/Roaming/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/8.0.3\~x64/packs/, recursive: true, session: 0.767841851414421): EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, stat 'c:\Users\Giedrius\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime.dotnet\8.0.3~x64\packs'

Expected Behavior

File watcher works, no error message shown.

Actual Behavior

File watcher doesn't work, error message is shown in console:

ERR MainThreadFileSystemEventService#$watch(): failed to stat a resource for file watching (extension: ms-dotnettools.csharp, path: file:///c:/Users/Giedrius/AppData/Roaming/Code/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/8.0.3\~x64/packs/, recursive: true, session: 0.767841851414421): EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, stat 'c:\Users\Giedrius\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime.dotnet\8.0.3~x64\packs'

Logs

Checked as suggested and ms-dotnettools.csharp log folder is completely empty, no logs there.

C# log

Failed to find dotnet info from path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime No compatible .NET runtime found. Minimum required version is 8.0. Dotnet path: c:\Users\Giedrius\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\8.0.3~x64\dotnet.exe Activating C# + C# Dev Kit... waiting for named pipe information from server... [stdout] {"pipeName":"\\\\.\\pipe\\d15864be"} received named pipe information from server attempting to connect client to server... client has connected to server [Info - 12:37:06 PM] [Program] Language server initialized [Info - 12:37:08 PM] [WorkspaceProjectFactoryService] Project C:\Users\Giedrius\Documents\Documents\OSM Games\Shil\Unity Projects\Shil\NavMeshComponentsEditor.csproj loaded by C# Dev Kit [Info - 12:37:08 PM] [WorkspaceProjectFactoryService] Project C:\Users\Giedrius\Documents\Documents\OSM Games\Shil\Unity Projects\Shil\NavMeshComponentsTestsPlaymode.csproj loaded by C# Dev Kit [Info - 12:37:08 PM] [WorkspaceProjectFactoryService] Project C:\Users\Giedrius\Documents\Documents\OSM Games\Shil\Unity Projects\Shil\NavMeshComponentsTestsEditmode.csproj loaded by C# Dev Kit [Info - 12:37:08 PM] [WorkspaceProjectFactoryService] Project C:\Users\Giedrius\Documents\Documents\OSM Games\Shil\Unity Projects\Shil\NavMeshComponentsExamplesEditor.csproj loaded by C# Dev Kit [Info - 12:37:08 PM] [WorkspaceProjectFactoryService] Project C:\Users\Giedrius\Documents\Documents\OSM Games\Shil\Unity Projects\Shil\NavMeshComponentsExamples.csproj loaded by C# Dev Kit [Info - 12:37:08 PM] [WorkspaceProjectFactoryService] Project C:\Users\Giedrius\Documents\Documents\OSM Games\Shil\Unity Projects\Shil\Assembly-CSharp-Editor.csproj loaded by C# Dev Kit [Info - 12:37:08 PM] [WorkspaceProjectFactoryService] Project C:\Users\Giedrius\Documents\Documents\OSM Games\Shil\Unity Projects\Shil\NavMeshComponents.csproj loaded by C# Dev Kit [Info - 12:37:08 PM] [WorkspaceProjectFactoryService] Project C:\Users\Giedrius\Documents\Documents\OSM Games\Shil\Unity Projects\Shil\Assembly-CSharp.csproj loaded by C# Dev Kit Failed to find dotnet info from path, falling back to acquire runtime via ms-dotnettools.vscode-dotnet-runtime No compatible .NET runtime found. Minimum required version is 8.0.

C# LSP Trace Logs

[Output_csharp_lsp_trace_logs.txt](https://github.com/dotnet/vscode-csharp/files/14835758/Output_csharp_lsp_trace_logs.txt)

Environment information

VSCode version: 1.87.2 C# Extension: 2.22.5 Using OmniSharp: false

Dotnet Information Host: Version: 8.0.3 Architecture: x64 Commit: 9f4b1f5d66 RID: win-x64 .NET SDKs installed: No SDKs were found. .NET runtimes installed: Microsoft.NETCore.App 8.0.3 [c:\Users\Giedrius\AppData\Roaming\Code\User\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\8.0.3~x64\shared\Microsoft.NETCore.App] Other architectures found: None Environment variables: Not set global.json file: Not found Learn more: https://aka.ms/dotnet/info Download .NET: https://aka.ms/dotnet/download
Visual Studio Code Extensions |Extension|Author|Version|Folder Name| |---|---|---|---| |astro-vscode|astro-build|2.8.5|astro-build.astro-vscode-2.8.5-win32-x64| |code-spell-checker|streetsidesoftware|3.0.1|streetsidesoftware.code-spell-checker-3.0.1| |copilot|GitHub|1.177.0|github.copilot-1.177.0| |copilot-chat|GitHub|0.13.1|github.copilot-chat-0.13.1| |csdevkit|ms-dotnettools|1.4.29|ms-dotnettools.csdevkit-1.4.29-win32-x64| |csharp|ms-dotnettools|2.22.5|ms-dotnettools.csharp-2.22.5-win32-x64| |gitignore|codezombiech|0.9.0|codezombiech.gitignore-0.9.0| |gitlens|eamodio|14.9.0|eamodio.gitlens-14.9.0| |markdown-all-in-one|yzhang|3.6.2|yzhang.markdown-all-in-one-3.6.2| |playwright|ms-playwright|1.0.22|ms-playwright.playwright-1.0.22| |prettier-vscode|esbenp|10.4.0|esbenp.prettier-vscode-10.4.0| |remote-containers|ms-vscode-remote|0.348.0|ms-vscode-remote.remote-containers-0.348.0| |todo-tree|Gruntfuggly|0.0.226|gruntfuggly.todo-tree-0.0.226| |ts-debug|kakumei|0.0.6|kakumei.ts-debug-0.0.6| |vscode-css-modules|clinyong|0.5.1|clinyong.vscode-css-modules-0.5.1| |vscode-docker|ms-azuretools|1.29.0|ms-azuretools.vscode-docker-1.29.0| |vscode-dotnet-runtime|ms-dotnettools|2.0.3|ms-dotnettools.vscode-dotnet-runtime-2.0.3| |vscode-eslint|dbaeumer|2.4.4|dbaeumer.vscode-eslint-2.4.4| |vscode-github-actions|github|0.26.2|github.vscode-github-actions-0.26.2| |vscode-graphql|GraphQL|0.9.3|graphql.vscode-graphql-0.9.3| |vscode-graphql-syntax|GraphQL|1.3.5|graphql.vscode-graphql-syntax-1.3.5| |vscode-intelephense-client|bmewburn|1.10.4|bmewburn.vscode-intelephense-client-1.10.4| |vscode-jest|Orta|6.2.3|orta.vscode-jest-6.2.3| |vscode-project-name-in-statusbar|mujichOk|1.0.0|mujichok.vscode-project-name-in-statusbar-1.0.0| |vscode-scss|mrmlnc|0.10.0|mrmlnc.vscode-scss-0.10.0| |vscode-scss-formatter|sibiraj-s|3.0.0|sibiraj-s.vscode-scss-formatter-3.0.0| |vscode-styled-components|styled-components|1.7.8|styled-components.vscode-styled-components-1.7.8| |vstuc|visualstudiotoolsforunity|1.0.0|visualstudiotoolsforunity.vstuc-1.0.0|;

Extension version: 2.22.5 VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 9 7900X 12-Core Processor (24 x 4700)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.21GB (17.01GB free)| |Process Argv|--crash-reporter-id b0c9102c-19fe-4402-bce9-dfc21ae25798| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 vscrp:30673768 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 d34g3935:30971562 fegfb526:30981948 bg6jg535:30979843 ccp2r3:30993541 dsvsc020:30976470 pythonait:31006305 7ghi1836:30988842 dsvsc021:30996838 gd77d436:30999572 ```
dibarbet commented 6 months ago

Thanks - essentially we're looking in known locations for things to watch, but sometimes the folder doesn't exist. This shouldn't impact the experience - if you're seeing otherwise let me know.

Ideally we should check to make sure the directories we want to watch exist before we tell vscode to watch them.

GiedriusT commented 6 months ago

Thanks, yes, after lots of digging I found that it was a different issue, not related to this error.