Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid file reported in Problems list #6309

Closed
jtsom opened this issue Sep 7, 2023 · 9 comments · Fixed by #6340
Closed

Invalid file reported in Problems list #6309

jtsom opened this issue Sep 7, 2023 · 9 comments · Fixed by #6340
Assignees
Milestone

Comments

@jtsom
Copy link

jtsom commented Sep 7, 2023

Type: Bug

Issue Description

After building a project, any errors or warning in the Problems tab reference incorrect files, that cannot be opened.

image

Steps to Reproduce

Build an application that has errors or warnings. Look in the Problems tab.

Expected Behavior

Correct files listed.

Actual Behavior

Incorrect, invalid file names listed.

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.82.0-insider
C# Extension: 2.1.2
Using OmniSharp: false

Dotnet Information Error running dotnet --info: Error: Command failed: C:\Program Files\dotnet\dotnet.exe --info 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Visual Studio Code Extensions
Extension Author Version Folder Name
azure-account ms-vscode 0.11.5 ms-vscode.azure-account-0.11.5
csdevkit ms-dotnettools 0.5.2 ms-dotnettools.csdevkit-0.5.2-win32-x64
csharp ms-dotnettools 2.1.2 ms-dotnettools.csharp-2.1.2-win32-x64
csharpextensions kreativ-software 1.7.3 kreativ-software.csharpextensions-1.7.3
ecdc mitchdenny 1.8.0 mitchdenny.ecdc-1.8.0
git-graph mhutchie 1.30.0 mhutchie.git-graph-1.30.0
hexeditor ms-vscode 1.9.12 ms-vscode.hexeditor-1.9.12
hl7tools RobHolme 2.0.4 robholme.hl7tools-2.0.4
indent-rainbow oderwat 8.3.1 oderwat.indent-rainbow-8.3.1
jwt-debugger yokawasa 0.4.2 yokawasa.jwt-debugger-0.4.2
kanagawa qufiwefefwoyn 1.5.1 qufiwefefwoyn.kanagawa-1.5.1
live-server ms-vscode 0.4.9 ms-vscode.live-server-0.4.9
material-icon-theme PKief 4.30.1 pkief.material-icon-theme-4.30.1
msbuild-project-tools tintoy 0.4.9 tintoy.msbuild-project-tools-0.4.9
night-owl sdras 2.0.1 sdras.night-owl-2.0.1
quicktype quicktype 12.0.46 quicktype.quicktype-12.0.46
rainbow-csv mechatroner 3.7.0 mechatroner.rainbow-csv-3.7.0
sync-scroll dqisme 1.3.1 dqisme.sync-scroll-1.3.1
TabOut albert 0.2.2 albert.tabout-0.2.2
vs-code-xml-format fabianlauer 0.1.5 fabianlauer.vs-code-xml-format-0.1.5
vscode-azureappservice ms-azuretools 0.25.0 ms-azuretools.vscode-azureappservice-0.25.0
vscode-azurefunctions ms-azuretools 1.12.4 ms-azuretools.vscode-azurefunctions-1.12.4
vscode-azureresourcegroups ms-azuretools 0.7.5 ms-azuretools.vscode-azureresourcegroups-0.7.5
vscode-azurestorage ms-azuretools 0.15.3 ms-azuretools.vscode-azurestorage-0.15.3
vscode-base64 adamhartford 0.1.0 adamhartford.vscode-base64-0.1.0
vscode-cosmosdb ms-azuretools 0.19.4 ms-azuretools.vscode-cosmosdb-0.19.4
vscode-dotnet-runtime ms-dotnettools 1.7.2 ms-dotnettools.vscode-dotnet-runtime-1.7.2
vscode-thunder-client rangav 2.11.4 rangav.vscode-thunder-client-2.11.4
vscodeintellicode VisualStudioExptTeam 1.2.30 visualstudioexptteam.vscodeintellicode-1.2.30
vscodeintellicode-csharp ms-dotnettools 0.1.26 ms-dotnettools.vscodeintellicode-csharp-0.1.26-win32-x64

Extension version: 2.1.2
VS Code version: Code - Insiders 1.82.0-insider (16e9205452dd417e32f164325b589b94892846b4, 2023-09-06T08:16:52.204Z)
OS version: Windows_NT x64 10.0.22621
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz (6 x 3000)
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 31.78GB (14.66GB free)
Process Argv --crash-reporter-id 362817d9-b661-4b35-92b7-fe18e5872851
Screen Reader no
VM 0%
A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256198
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
vscod805cf:30301675
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30404738
py29gd2263:30784851
vsclangdf:30492506
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30618038
vscrp:30624060
a9j8j154:30646983
showlangstatbar:30737417
ecj1e332:30687743
pythonfmttext:30716741
fixshowwlkth:30771523
showindicator:30805243
pythongtdpath:30726887
i26e3531:30792625
welcomedialog:30812478
pythonnosmt12:30779711
pythonidxpt:30768918
pythonnoceb:30776497
copilotsettingt:30808721
dsvsc013:30777762
dsvsc014:30777825
diffeditorv2:30786206
pythonlinttype:30823781
pythonmpsinfo:30815194
dsvsc015:30821418
pythontestfixt:30826906
pythonfb280951:30830809

@jtsom
Copy link
Author

jtsom commented Sep 7, 2023

Whatever is scraping the error information from the terminal output is being confused by the width of the terminal. Making the window wider or narrower will affect what is listed in the Problems tab.

@jtsom
Copy link
Author

jtsom commented Sep 7, 2023

Downgrading C# extension from 2.1.2 to previous (2.0.436) helps, somewhat. The files listed in the Problems tab look correct, but some of the error / warning text is still cut off (based on the size of the Terminal pane)

Actually, no it's not. The same thing is happening. File names are being truncated in 2.0.436)

@dibarbet dibarbet self-assigned this Sep 8, 2023
@dibarbet dibarbet added this to the September milestone Sep 8, 2023
@dibarbet
Copy link
Member

dibarbet commented Sep 8, 2023

@jtsom would you be able to set the configuration dotnet.server.trace to Trace, run the repro and then attach both the C# output window logs and C# LSP trace logs? If you don't want to share them publicly, you can also send them to my email (listed on my profile).

@jtsom
Copy link
Author

jtsom commented Sep 11, 2023

Here are the logs. The build error window looks like this for these logs:
image
C#Log.txt
C#LSPTrace.txt

@dibarbet
Copy link
Member

Ah apologies I originally mis-read this and thought these were coming from the live diagnostics, but these are coming from the build.

@jtsom How are you invoking the build - do you have a tasks.json in your repo? Or are you invoking the '.NET Build' command? And would you mind posting the a snippet of the actual terminal output for the errors?

@jtsom
Copy link
Author

jtsom commented Sep 11, 2023

In this instance, I am using the Tasks: Run Build Tasks command (Control-Shift-B). When using the dotnet build command in a terminal window, any problems do not get reported in the "Problems" tab. And the tasks.json file in the project is the standard one that was created when the project was built.

Here is one warning that appears in the Terminal, after doing a Control-Shift-B (Note where the line break is, just after the 'T':

D:\source\repos\MyCompany.EMRApi\MyCompany.Infrastructure\MyCompany.Queries.Core\FileSystem\PathMappings.cs(23,34): warning CS8632: T 
he annotation for nullable reference types should only be used in code within a '#nullable' annotations context. [D:\source\repos\MyCompany.EMRApi\My 
Company.Infrastructure\MyCompany.Queries.Core\MyCompany.Queries.Core.csproj]

Here is the Problems window (note that there is only ONE entry in the Problems tab, but there are 11 actual warnings in the Terminal tab, but are NOT shown in the Problems tab:

image

If I shrink the window down, to make more line breaks, and if it happens to be in the middle of the file name in the warning, that message in the Problems tab will not have the full file name, and clicking it will show an error about not being able to open the referenced file.

image

D:\source\repos\MyCompany.EMRApi\MyCompany.In 
frastructure\MyCompany.Queries.Core\FileSystem\IFileSy 
stemManager.cs(7,58): warning CS8632: The annotation for nullab 
le reference types should only be used in code within a '#nulla 
ble' annotations context. [D:\source\repos\MyCompany.E 
MRApi\MyCompany.Infrastructure\MyCompany.Quer 
ies.Core\MyCompany.Queries.Core.csproj]

(And this time, after doing a clean and build, I am seeing 13 messages in the Problems tab (Yes I did a clean previously when I only saw 1 message)

@jtsom
Copy link
Author

jtsom commented Sep 11, 2023

FWIW - I modified the build task in the tasks.json to change the /consoleloggerparameters to include ForceNoAlign and that seems to make the problems tab show correctly:

 "tasks": [
        {
            "label": "build",
            "command": "dotnet",
            "type": "process",
            "args": [
                "build",
                "${workspaceFolder}/DigitalOptometrics.EMRApi.sln",
                "/property:GenerateFullPaths=true",
                "/consoleloggerparameters:NoSummary;ForceNoAlign"
            ],
            "problemMatcher": "$msCompile"
        },
...
]

@dibarbet
Copy link
Member

dibarbet commented Sep 11, 2023

Thanks - thats helpful. We actually don't own the msCompile problem matcher, that is defined by vscode - https://github.com/microsoft/vscode/blob/35425d369ada2ba625304f9adb626332f13d1753/src/vs/workbench/contrib/tasks/common/problemMatcher.ts#L1286

However what we should do here (and what you found) is update our tasks.json generation to include ForceNoAlign here - https://github.com/dotnet/vscode-csharp/blob/main/src/shared/assets.ts#L296

I'll take a look at doing that.

@jtsom
Copy link
Author

jtsom commented Sep 12, 2023

Cool thanks! Glad I found a work around, but agree the problem matched does seem to have a issue, as the tasks.json has not had that parameter and it's has been working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants