microsoft / vscode-mono-debug

A simple VS Code debug adapter for mono
Other
163 stars 174 forks source link

Use mono source for debugger-libs #64

Closed jonathanpeppers closed 4 years ago

jonathanpeppers commented 4 years ago

I was attempting to use this extension to debug a Xamarin.Android application. It "sort of" works, except the locals render in an odd way, such as:

Local
    arg0: 0xfffffffff0b76140
    arg1: 0xffffffffffff894c
    arg2: 0x0

I think the issue is just that the Mono debugger libraries are old and out of date.

The NuGet packages being used for the Mono debugger are unlisted and unmaintained, such as:

https://www.nuget.org/packages/Mono.Debugging/1.0.20161020.46

Within Xamarin, most projects add a git submodule for mono/debugger-libs and xamarin/nrefactory and build these libraries from source. This allowed me to remove NuGet packages and use @(ProjectReference) instead.

I also had to update $(TargetFrameworkVersion) to v4.7.2.

After doing this, I updated some other NuGet packages so their versions matched what debugger-libs is using:

Now I can see proper locals in a Xamarin.Android app!

image

Using a launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "mono",
            "request": "attach",
            "address": "localhost",
            "port": 10000,
            "preLaunchTask": "Debug",
        }
    ]
}

And a tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Debug",
            "type": "shell",
            "command": "msbuild HelloAndroid/HelloAndroid.csproj -t:Install,_Run -p:AndroidAttachDebugger=true"
        },
    ]
}

I will setup a .NET 6 example in this repo down the road:

https://github.com/xamarin/net6-samples

jonathanpeppers commented 4 years ago

I was seeing this build error locally as well:

src/typescript/tests/adapter.test.ts:91:38 - error TS2559: Type '10' has no properties in common with type '{ path?: string | RegExp; line?: number; column?: number; }'.

I think I did the right thing to fix it, I don't know much about TypeScript, though.

jonathanpeppers commented 4 years ago

@akoeplinger are you able to review or merge this?