microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
234 stars 13 forks source link

"launch: program" runs the wrong project #1414

Open AlexanderChakerOnesky opened 2 months ago

AlexanderChakerOnesky commented 2 months ago

Type: Bug

I have switched from VS to VSCode for MAUI Hybrid development since .net 8 and now 9 preview 7. I did the same setup on both my personal and my work laptops. It works fine on my personal, but on my work laptop, running a MAUI project by hitting F5 will build the project successfully, and then throw the below error when trying to run it. Note that the exe it's trying to run is not the project I'm trying to run, it's somehow pointing to the same non-existing project no matter which project I try to run. launch: program 'C:\Users\alexander.chaker\DevProjects\DeployGitBranch\bin\Debug\n...\DeployGitBranch.exe' does not exist.

Things I tried which did NOT work:

What worked, but is not a solution: Setting up a new Windows user, dotnet, and vscode. Also running "dotnet run..." in the terminal successfully runs the project, so it must be the vscode extension that's failing.

How can I try to see very detailed logs to know where/why it's loading the wrong project? Any other folders/regedit that I need to delete in order reset the config?

Extension version: 1.3.3 VS Code version: Code 1.92.2 (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i9-12900HK (20 x 2918)| |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
webnn: disabled_off| |Load (avg)|undefined| |Memory (System)|63.68GB (27.35GB free)| |Process Argv|--crash-reporter-id 4cf179ea-59be-4714-8b15-d348d777dc29| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805cf:30301675 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 2e7ec940:31000449 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 01bff139:31013167 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 newcmakeconfigv2:31071590 impr_priority:31102340 refactort:31108082 pythonrstrctxt:31112756 flighttreat:31119336 wkspc-onlycs-c:31111717 wkspc-ranged-c:31125598 ei213698:31121563 aajjf12562:31125793 ```

| VS Bug 2250171

emaf commented 2 months ago

@AlexanderChakerOnesky a few things to check

AlexanderChakerOnesky commented 2 months ago

@emaf

That's my "launch.json"

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET MAUI",
            "type": "maui",
            "request": "launch",
            "preLaunchTask": "maui: Build"
        }
    ]
}

This is the terminal output on build (F5)

Executing task: dotnet build -t:Build -p:Configuration=Debug -f net9.0-windows10.0.19041.0 -p:WindowsPackageType=None -v:normal -bl C:\Users\alexander.chaker\Programming\TestMAUI\MauiApp1.csproj 

You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  MauiApp1 net9.0-windows10.0.19041.0 succeeded (2.8s) → bin\Debug\net9.0-windows10.0.19041.0\win10-x64\MauiApp1.dll

Build succeeded in 3.1s

Then I get this error, which is an old non-existing project I compiled a while ago:

image

github-actions[bot] commented 2 months ago

@emaf, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.

emaf commented 2 months ago

@AlexanderChakerOnesky in the Run and Debug view, do you see the following? image

AlexanderChakerOnesky commented 2 months ago

@emaf I do

image

This is the same project running using VS image

emaf commented 2 months ago

@AlexanderChakerOnesky thanks for attaching those screenshots.

Does this happen if you run the project for Android? I'm trying to understand if this is a general problem or a platform specific issue.

AlexanderChakerOnesky commented 2 months ago

@emaf Seems this is a Windows specific issue. It took me while to setup Android development in VSCode with all the version incompatibilities. I also had to create a new .Net8 project (vs .Net9 above). In the end I was able run the Android app just fine (see screenshot below). When I used the same project to run on Windows Local Machine, it failed as before. image

AlexanderChakerOnesky commented 1 month ago

Anyone on the MAUI Extension team knows if I want to delete the extension completely with it's data, where are the locations to do that? Does it use any Windows Registry? User's AppData? I'm now on version v1.4.36 and this is still an issue for me in VSCode.