dotnet / razor

Compiler and tooling experience for Razor ASP.NET Core apps in Visual Studio, Visual Studio for Mac, and VS Code.
https://asp.net
MIT License
505 stars 195 forks source link

False positives in IDE problems list #10221

Open james-white-x opened 8 months ago

james-white-x commented 8 months ago

Type: Bug

Issue Description

My Problems is showing lots of false positives for Razor which is making it impossible to see actual problems.

How can I supress these 2 codes whilst you look at a fix as this is really slowing me down

Steps to Reproduce

  1. Make a blazor project and have a using in _imports.razor and add a page with EditForm and some blazor input components

Expected Behavior

Not to show errors and warnings which are not issues

Actual Behavior

It shows these

Logs

C# log

Post the output from Output-->C# here

C# LSP Trace Logs

Post the output from Output-->C# LSP Trace Logs here. Requires `dotnet.server.trace` to be set to `Trace`

Environment information

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

Dotnet Information .NET SDK: Version: 8.0.202 Commit: 25674bb2f4 Workload version: 8.0.200-manifests.a7f084b6 Runtime Environment: OS Name: ubuntu OS Version: 22.04 OS Platform: Linux RID: linux-x64 Base Path: /usr/share/dotnet/sdk/8.0.202/ .NET workloads installed: There are no installed workloads to display. Host: Version: 8.0.3 Architecture: x64 Commit: 9f4b1f5d66 .NET SDKs installed: 8.0.202 [/usr/share/dotnet/sdk] .NET runtimes installed: Microsoft.AspNetCore.App 8.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Other architectures found: None Environment variables: DOTNET_ROOT [/usr/share/dotnet] 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| |---|---|---|---| |aspnetcorerazor-html-css-class-completion|kevin-chatham|1.0.3|kevin-chatham.aspnetcorerazor-html-css-class-completion-1.0.3| |csharp|ms-dotnettools|2.22.3|ms-dotnettools.csharp-2.22.3-linux-x64| |data-workspace-vscode|ms-mssql|0.5.0|ms-mssql.data-workspace-vscode-0.5.0| |debugpy|ms-python|2024.2.0|ms-python.debugpy-2024.2.0-linux-x64| |git-graph|mhutchie|1.30.0|mhutchie.git-graph-1.30.0| |gitflow|vector-of-bool|1.2.1|vector-of-bool.gitflow-1.2.1| |githistory|donjayamanne|0.6.20|donjayamanne.githistory-0.6.20| |gitlens|eamodio|14.9.0|eamodio.gitlens-14.9.0| |mssql|ms-mssql|1.22.1|ms-mssql.mssql-1.22.1| |powershell|ms-vscode|2024.0.0|ms-vscode.powershell-2024.0.0| |prettier-sql-vscode|inferrinizzard|1.6.0|inferrinizzard.prettier-sql-vscode-1.6.0| |prettier-vscode|esbenp|10.1.0|esbenp.prettier-vscode-10.1.0| |snyk-vulnerability-scanner|snyk-security|2.3.7|snyk-security.snyk-vulnerability-scanner-2.3.7| |sql-bindings-vscode|ms-mssql|0.4.0|ms-mssql.sql-bindings-vscode-0.4.0| |sql-database-projects-vscode|ms-mssql|1.4.1|ms-mssql.sql-database-projects-vscode-1.4.1| |sqltools|mtxr|0.28.1|mtxr.sqltools-0.28.1| |sqltools-driver-mssql|mtxr|0.4.2|mtxr.sqltools-driver-mssql-0.4.2| |svg|jock|1.5.3|jock.svg-1.5.3| |todo-tree|Gruntfuggly|0.0.226|gruntfuggly.todo-tree-0.0.226| |vscode-color-picker|AntiAntiSepticeye|0.0.4|antiantisepticeye.vscode-color-picker-0.0.4| |vscode-dotnet-pack|ms-dotnettools|1.0.13|ms-dotnettools.vscode-dotnet-pack-1.0.13| |vscode-dotnet-runtime|ms-dotnettools|2.0.2|ms-dotnettools.vscode-dotnet-runtime-2.0.2| |vscode-eslint|dbaeumer|2.4.4|dbaeumer.vscode-eslint-2.4.4| |vscode-html-css|ecmel|2.0.9|ecmel.vscode-html-css-2.0.9| |vscode-import-cost|wix|3.3.0|wix.vscode-import-cost-3.3.0| |vscode-jest|Orta|6.2.2|orta.vscode-jest-6.2.2| |vscode-lottie|lottiefiles|1.0.5|lottiefiles.vscode-lottie-1.0.5| |vscode-markdownlint|DavidAnson|0.54.0|davidanson.vscode-markdownlint-0.54.0| |vscode-nuget-gallery|patcx|0.0.24|patcx.vscode-nuget-gallery-0.0.24| |vscode-pull-request-github|GitHub|0.82.0|github.vscode-pull-request-github-0.82.0| |vscode-xml|redhat|0.26.1|redhat.vscode-xml-0.26.1-linux-x64| |vscode-yaml|redhat|1.14.0|redhat.vscode-yaml-1.14.0|;

Extension version: 2.22.3 VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z) OS version: Windows_NT x64 10.0.19045 Modes: Remote OS version: Linux x64 5.15.146.1-microsoft-standard-WSL2

System Info |Item|Value| |---|---| |CPUs|AMD Ryzen 7 Microsoft Surface (R) Edition (16 x 1996)| |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)|15.45GB (1.77GB free)| |Process Argv|--crash-reporter-id f28b5a18-e7d9-4c97-873a-6695beca75bd| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu| |OS|Linux x64 5.15.146.1-microsoft-standard-WSL2| |CPUs|AMD Ryzen 7 Microsoft Surface (R) Edition (8 x 1996)| |Memory (System)|7.76GB (3.37GB free)| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805cf:30301675 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyonecf:30548226 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:30986171 pythontbext0:30879054 accentitlementst:30887150 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 pydisww2:30981708 cppperfcontrol:30979541 d34g3935:30971562 fegfb526:30981948 bg6jg535:30979843 dsvsc020:30976470 ```
COOLIRON2311 commented 8 months ago

Having the same issue

slmnow commented 8 months ago

Confirmed this problem goes away when 2.22.3 is uninstalled

COOLIRON2311 commented 8 months ago

@slmnow @james-white-x I've just updated to 2.22.5 and it seems that the issue isn't present anymore.

james-white-x commented 8 months ago

@COOLIRON2311 I have updated to 2.22.5, still have these warnings coming up? image

james-white-x commented 8 months ago

Thought it had fixed it but all my razor pages are still showing the false positives

james-white-x commented 8 months ago

Just trying to troubleshoot it a bit, my razor pages are only showing these warnings and actually missing valid warnings like nullables

ryzngard commented 7 months ago

@james-white-x I'm sorry you're still hitting this issue. Can you provide detailed logs by doing the following?

  1. Go to Settings > C# > Razor Server: Trace and set the value to Trace
  2. Reproduce the issue
  3. Copy razor logs from the output window in VS Code.
james-white-x commented 7 months ago

@ryzngard razor.log

I have put 3 minutes worth of logs up, you can see how often things are triggering here.

If you need anything more, let me know

ryzngard commented 7 months ago

@james-white-x it looks like you added the C# logs? We would need the Razor logs.

This can be done by selecting the Razor Log in the output window

image

james-white-x commented 7 months ago

@ryzngard Sorry, missed that it was a separate log, razor log attached razor_new.log