Using Visual Studio (Windows) to do manged debugging of Wine WPF app

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
pgruebele
Newbie
Newbie
Posts: 1
Joined: Tue Feb 09, 2021 10:09 am

Using Visual Studio (Windows) to do manged debugging of Wine WPF app

Post by pgruebele »

As the title states, I got this to work and it is GREAT. I can use Visual Studio to remotely attach to my WPF app running under Wine (Ubuntu in my case) and do normal managed debugging as if the app were running locally in Windows.

I posted the method at https://github.com/microsoft/MIEngine/issues/1105 but here is the just of it:

For anyone else who is interested here is what I did:

1. Follow the overall instructions at https://github.com/microsoft/MIEngine/w ... ual-Studio to set things up (ssh etc).

2. Since Wine runs the WPF app, vsdbg also needs to run within Wine. To get that I installed VS Code on Windows, installed the extension "C# for Visual Studio Code (powered by OmniSharp)", and copied "%USERPROFILE%.vscode\extensions\ms-dotnettools.csharp-1.23.9.debugger" to "~/vs-debugger"

3. Change launch.json like this so vsdbg runs under Wine as well:

Code: Select all

    {
    "version": "0.2.0",
    "adapter": "C:\...bin\PLINK.EXE",
    "adapterArgs": "-i C:\...\ssh-ubuntu.ppk [email protected] -batch -T wine ~/.vs-debugger/vsdbg.exe",
    "configurations": [
    {
    "name": ".NET Core Ubuntu Wine Launch",
    "type": "coreclr",

         //"request": "launch",
         //"cwd": "/usr/bin/wine",
         //"program": "/home/user/debug/xyz.dll",

         "request": "attach",
         // replace with the process id you want to attach to. You can find this by running 'pidof' in the container
         // ex: `docker exec -it my_container_name pidof dotnet`
         // For Wine, use Wine TaskManager to get the PID of your WPF app (not the unix pid).
         "processId": 204
     }

    ]
    }
Note that "processId" must be obtained from the Wine task manager. It is not the linux process.

Happy debugging!
Locked