Closed allisonchou closed 1 year ago
I receive this error whenever a code format is attempted. Enabling VSCode's Editor: Format On Type setting makes the error pop up for me every time a line is completed (therefore meaning the Enter key).
I assume it's a problem that comes from the ever-faulty Microsoft C# extension trying to format the code but failing. Going to VSCode's settings and using "@ext:ms-dotnettools.csharp" to navigate to the extension's settings, finding CSharp>Format:Enable, disabling it and restarting didn't fix the issue.
Toggling the setting "Omnisharp: Use Editor Formatting Settings" also did not resolve the issue.
Adjusting the editor in settings.json ("editor.defaultFormatter": "ms-dotnettools.csharp") to use "esbenp.prettier-vscode" (if you have Prettier installed) DID get rid of the C# extension's complaints, but your code will remain unformatted as Prettier does not handle C#/.cshtml files. So while I cannot fix it, I can at least silence it, especially if I want my Format on Type enabled.
This was fixed by https://github.com/dotnet/razor/pull/8318
Transferred from https://github.com/OmniSharp/omnisharp-vscode/issues/5555.
Issue Description
VSCode C# Extension throws an error when Enter is hit. I have tried all keys on a regular English keyboard and the only one giving the error is Enter.
Steps to Reproduce
Expected Behavior
Not throwing an error every time the Enter key is being hit.
Actual Behavior
Hitting Enter pops up an error message
Logs
Razor log
OmniSharp log
C# log
Empty
Environment information
VSCode version: 1.74.3 C# Extension: 1.25.4
Mono Information
OmniSharp using mono: 6.12.0Dotnet Information
.NET SDK: Version: 7.0.101 Commit: bb24aafa11 Runtime Environment: OS Name: manjaro OS Version: OS Platform: Linux RID: manjaro-x64 Base Path: /usr/share/dotnet/sdk/7.0.101/ Host: Version: 7.0.1 Architecture: x64 Commit: 97203d38ba .NET SDKs installed: 5.0.408 [/usr/share/dotnet/sdk] 7.0.101 [/usr/share/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 5.0.17 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.12 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Other architectures found: None Environment variables: DOTNET_ROOT [/usr/share/dotnet] global.json file: Not foundVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |better-cpp-syntax|jeff-hykin|1.17.2| |blazorwasm-companion|ms-dotnettools|1.1.0| |cmake|twxs|0.0.17| |cmake-language-support-vscode|josetr|0.0.9| |cmake-tools|ms-vscode|1.13.41| |cpptools|ms-vscode|1.13.9| |cpptools-extension-pack|ms-vscode|1.3.0| |cpptools-themes|ms-vscode|2.0.0| |csharp|ms-dotnettools|1.25.4| |dakara-foldplus|dakara|1.5.2| |dotnet-core-essentials|KishoreIthadi|0.0.8| |doxdocgen|cschlosser|1.4.0| |es7-react-js-snippets|dsznajder|4.4.3| |fabric8-analytics|redhat|0.3.6| |felgo|felgo|1.0.3| |fluent-icons|miguelsolorio|0.0.18| |format-html-in-php|rifi2k|1.7.0| |githistory|donjayamanne|0.6.19| |go|golang|0.37.1| |godot-csharp-vscode|neikeq|0.2.1| |godot-tools|geequlim|1.3.1| |hexeditor|ms-vscode|1.9.10| |html-snippets|abusaidm|0.2.1| |icons|tal7aouy|3.6.1| |inline-fold|moalamri|0.2.2| |intellicode-api-usage-examples|VisualStudioExptTeam|0.2.6| |isort|ms-python|2022.8.0| |java|redhat|1.14.0| |js-jsx-snippets|skyran|11.0.1| |jupyter|ms-toolsai|2022.11.1003412109| |jupyter-keymap|ms-toolsai|1.0.0| |jupyter-renderers|ms-toolsai|1.0.14| |kite|kiteco|0.147.0| |LiveServer|ritwickdey|5.7.9| |mono-debug|ms-vscode|0.16.3| |node-snippets|chris-noring|1.3.3| |php|tal7aouy|1.0.2| |php-debug|xdebug|1.30.0| |php-intellisense|zobo|1.0.13| |php-pack|xdebug|1.0.3| |python|ms-python|2022.20.2| |qtvsctools|tonka3000|0.11.0| |rainbow-csv|mechatroner|3.5.0| |regionfolder|maptz|1.0.20| |remote-containers|ms-vscode-remote|0.266.1| |rust-analyzer|rust-lang|0.3.1377| |sass-indented|syler|1.8.23| |targetframeworksswitcher|yamachu|1.0.3| |unity-code-snippets|kleber-swf|1.3.0| |unity-debug|Unity|3.0.2| |unity-tools|Tobiah|1.2.12| |vetur|octref|0.36.1| |volar|Vue|1.0.24| |vsc-material-theme-icons|equinusocio|2.5.0| |vscode-css-peek|pranaygp|4.2.0| |vscode-diff|fabiospampinato|1.4.2| |vscode-docker|ms-azuretools|1.23.3| |vscode-dotnet-runtime|ms-dotnettools|1.6.0| |vscode-eslint|dbaeumer|2.2.6| |vscode-gradle|vscjava|3.12.6| |vscode-html-css|ecmel|1.13.1| |vscode-icons|vscode-icons-team|12.2.0| |vscode-intelephense-client|bmewburn|1.9.4| |vscode-java-debug|vscjava|0.47.0| |vscode-java-dependency|vscjava|0.21.1| |vscode-java-pack|vscjava|0.25.7| |vscode-java-test|vscjava|0.37.1| |vscode-jupyter-cell-tags|ms-toolsai|0.1.6| |vscode-jupyter-slideshow|ms-toolsai|0.1.5| |vscode-maven|vscjava|0.40.4| |vscode-pylance|ms-python|2023.1.30| |vscode-tailwindcss|bradlc|0.9.6| |vscode-yaml|redhat|1.11.0| |vscodeintellicode|VisualStudioExptTeam|1.2.30| |vue|znck|0.12.0| |yaclock|jameslan|1.0.1|;