Unpredictable Ghost errors in Blazor app
- Dominant language
- TypeScript
- Stars
- 3.1k
- Forks
- 737
- Avg merge
- 18h 40m
- Merged PRs (30d)
- 31
Description
## Issue Description ##
In a Blazor Hosted app, VS Code shows many errors in the Problems section, but the project builds fine, I can run the app via terminal (`dotnet run`) or debug it.
## Steps to Reproduce ##
1. Create a Blazor Page, for example `UserPage.razor`.
2. Create a partial class to be couple with the Page, for example `UserPage.razor.cs`.
3. In the cs partial class add this method: `private void OnOkClicked() { /* Do something */ }`
4. In the razor Page add this element: `Ok`
## Expected Behavior ##
Since the code compiles fine and executes fine, I should see an empty Problems panel.
## Actual Behavior ##
The panel is filled with an empty error saying something like:
"CS0428",
"severity": 8,
"message": "Cannot convert method group 'OnOkClicked' to non-delegate type 'object'. Did you intend to invoke the method?",
This error is not predictable, it happens only sometimes. I always inject delegates in the form `@onclick=@OnOkClicked`, with the `@` instead of surrounding the delegate's name with quotes (like `@onclick="OnOkClicked"`). Out of hundreds of delegates set in this way, sometimes Omnisharp indicates 3 of them as errors, sometimes 71, sometimes 241... with the same exact solution and code. It seems totally random.
This happens at least from version 1.23.4, 1.23.5 and kept happening with every extension's upgrade, with .NET 5.0 but also with .NET Core 3.1.
## Logs ##
### OmniSharp log ###
Post the output from Output-->OmniSharp log here
### C# log ###
Post the output from Output-->C# here
## Environment information ##
**VSCode version**: 1.53.0
**C# Extension**: 1.23.9
Mono Information
OmniSharp using built-in mono
Dotnet Information
.NET SDK (reflecting any global.json):
Version: 5.0.102
Commit: 71365b4d42
Runtime Environment:
OS Name: Mac OS X
OS Version: 11.0
OS Platform: Darwin
RID: osx.11.0-x64
Base Path: /usr/local/share/dotnet/sdk/5.0.102/
Host (useful for support):
Version: 5.0.2
Commit: cb5f173b96
.NET SDKs installed:
2.1.811 [/usr/local/share/dotnet/sdk]
3.1.404 [/usr/local/share/dotnet/sdk]
3.1.405 [/usr/local/share/dotnet/sdk]
5.0.101 [/usr/local/share/dotnet/sdk]
5.0.102 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.23 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.23 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.23 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
|Extension|Author|Version|
|---|---|---|
|auto-close-tag|formulahendry|0.5.10|
|auto-rename-tag|formulahendry|0.1.6|
|Bookmarks|alefragnani|12.1.4|
|code-settings-sync|Shan|3.4.3|
|cpptools|ms-vscode|1.2.0|
|csharp|ms-dotnettools|1.23.9|
|csharpsortusings|jongrant|0.0.3|
|debugger-for-chrome|msjsdiag|4.12.12|
|dotenv|mikestead|1.0.1|
|EditorConfig|EditorConfig|0.16.4|
|eml|leighlondon|0.4.0|
|git-project-manager|felipecaputo|1.7.1|
|githistory|donjayamanne|0.6.14|
|gitlens|eamodio|11.2.1|
|html-snippets|abusaidm|0.2.1|
|htmltagwrap|bradgashler|0.0.7|
|import-sorter|mike-co|3.3.1|
|JavaScriptSnippets|xabikos|1.8.0|
|jinja|wholroyd|0.0.8|
|js-debug-nightly|ms-vscode|2021.2.117|
|latex-workshop|James-Yu|8.15.0|
|MagicPython|magicstack|1.1.0|
|markdown-shortcuts|mdickin|0.12.0|
|mssql|ms-mssql|1.10.1|
|npm-intellisense|christian-kohler|1.3.1|
|oracle-plsql|mycelo|1.0.3|
|output-colorizer|IBM|0.1.2|
|overtype|adammaras|0.2.0|
|path-intellisense|christian-kohler|2.3.0|
|powershell|ms-vscode|2020.6.0|
|propertylist|zhouronghui|0.0.2|
|python|ms-python|2021.1.502429796|
|python-extension-pack|donjayamanne|1.6.0|
|sass-indented|robinbentley|1.5.1|
|sqltools|mtxr|0.23.0|
|sqltools-driver-pg|mtxr|0.2.0|
|vscode-attrs-sorter|mrmlnc|2.1.0|
|vscode-css-formatter|aeschli|1.0.1|
|vscode-django|batisteo|1.3.0|
|vscode-docker|ms-azuretools|1.9.1|
|vscode-eslint|dbaeumer|2.1.14|
|vscode-icons|vscode-icons-team|11.1.0|
|vscode-npm-script|eg2|0.3.13|
|vscode-nuget-package-manager|jmrog|1.1.6|
|vscode-open-multiple-files|fabiospampinato|1.3.0|
|vscode-react-native|msjsdiag|1.3.0|
|vscode-search-open-all-results|fabiospampinato|1.0.3|
|vscode-sort|henriiik|0.2.5|
|vscode-sort-json|richie5um2|1.19.2|
|vscode-test-explorer|hbenl|2.19.5|
|vscode-xml|redhat|0.15.0|
|vscode-yaml|redhat|0.14.0|
|vscode-yarn|gamunu|1.7.1|
|vscodeintellicode|VisualStudioExptTeam|1.2.11|;
Contributor guide
Assessment
This issue has not been assessed yet.