microsoft / microsoft/MIEngine
.Net Core for Unix engine does not load debug symbols for remote Maui Mac Catalyst debugging.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 859
- Forks
- 233
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 3
Description
Visual Studio 2022 for Windows does not have functionality for debugging .Net Maui Mac Catalyst apps on a remote Mac host like you can for iOS development so I am currently building a VS Extension for my company (and public) that facilitates the transfer of the project over to a remote Mac host for building, debugging and launching the Mac Catalyst platform of our app, my extension is called Pair To Mac Catalyst.
I have everything working except connecting the debugger properly. I can connect to vsdbg and launch Maui Mac Catalyst app fine, but the debugger does not load the debug symbols, i.e. *.pdb files. I can't see modules in my modules window and I can't set breakpoints in VS 2022.
I have followed the instruction on Offroad Debugging of .NET Core on Linux OSX from Visual Studio.
My current launch.json config is as follows:
{
"version": "0.2.0",
"adapter": "C:\\<path-to>\\plink.exe",
"adapterArgs": "-pw pass host@ip ~/vsdbg/vsdbg",
"languageMappings": {
"C#": {
"languageId": "3F5162F8-07C6-11D3-9053-00C04FA302A1",
"extensions": [ "*" ]
}
},
"configurations": [
{
"name": ".NET MAUI Launch",
"type": "coreclr",
"request": "launch",
"program": "MauiApp1.app/Contents/MacOS/MauiApp1",
"args": [],
"cwd": "**/MauiApp1/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64",
"justMyCode": false,
"requireExactSource": false,
"symbolSearchPath": "https://symbols.nuget.org/download/symbols;/**/MauiApp1/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/**/*.pdb",
"symbolOptions": {
"loadedOnlyIncluded": false,
"searchPaths": [
"https://symbols.nuget.org/download/symbols",
"**/MauiApp1/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/**/*.pdb",
],
"moduleFilter": {
"mode": "loadAllButExcluded",
"excludedModules": []
}
},
"sourceFileMap": {
"C:\\<local-project-path>": "/<mac-project-path>"
},
"logging": {
"trace": true,
"traceResponse": true,
"programOutput": true,
"exceptions": true,
"moduleLoad": true
}
}
]
}
Note: I am using full paths in my real config so all the paths should be resolving correctly.
I am currently using the following command to at least get the debugger working correctly during development of my extension:
DebugAdapterHost.Launch /LaunchJson:"C:\<path-to>\MauiApp1\Properties\launch.json" /EngineGuid:541B8A8A-6081-4506-9F0A-1CE771DEBC04
I noticed in my "Debug Adaptor Host Log" the following:
1> [DebugAdapter] --> C (setSymbolOptions-17): {"type":"request","command":"setSymbolOptions","arguments":{"symbolOptions":{"moduleFilter":{"mode":"loadOnlyIncluded","includedModules":[""]}}},"seq":17}
So as I see it, the following is not overriding the default settings for the .Net Core for Unix engine \ 541B8A8A-6081-4506-9F0A-1CE771DEBC04 ...
"symbolSearchPath": "https://symbols.nuget.org/download/symbols;/**/MauiApp1/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/**/*.pdb",
"symbolOptions": {
"loadedOnlyIncluded": false,
"searchPaths": [
"https://symbols.nuget.org/download/symbols",
"**/MauiApp1/bin/Debug/net9.0-maccatalyst/maccatalyst-arm64/**/*.pdb",
],
"moduleFilter": {
"mode": "loadAllButExcluded",
"excludedModules": []
}
},
When I set a breakpoint, I also get the following response from my remote vsdbg instance.
1> [DebugAdapter] <-- R (addBreakpoint-25) [78 ms]: {"type":"response","request_seq":25,"success":true,"command":"addBreakpoint","body":{"breakpoint":{"id":4,"verified":false,"message":"No symbols have been loaded for this document."}},"seq":35}
Does your team have any insight on how to load modules\symbols on OSX over SSH\VSDBG for Maui Mac Catalyst apps?
While I am at it, what would be the correct way to set the config for IVsDebugger4 so I don't have to create a launch.json file on the fly and run a launch command? Currently I am playing around with the following but get an unknown error:
Guid guidUnixDebugEngine = Guid.Parse("541B8A8A-6081-4506-9F0A-1CE771DEBC04");
IntPtr pguidDebugEngine = Marshal.AllocCoTaskMem(Marshal.SizeOf(guidUnixDebugEngine));
Marshal.StructureToPtr(guidUnixDebugEngine, pguidDebugEngine, false);
VsDebugTargetInfo4[] pDebugTargets = new VsDebugTargetInfo4[1];
// pDebugTargets[0].bstrExe = "MauiApp1";
// pDebugTargets[0].bstrRemoteMachine = $"{_macBridgeService.MacConnection.IpAddress}:{4024}";
pDebugTargets[0].dlo = (uint)DEBUG_LAUNCH_OPERATION.DLO_AlreadyRunning;
pDebugTargets[0].guidLaunchDebugEngine = guidUnixDebugEngine;
pDebugTargets[0].dwDebugEngineCount = 1;
pDebugTargets[0].pDebugEngines = pguidDebugEngine;
pDebugTargets[0].fSendToOutputWindow = true;
pDebugTargets[0].bstrRemoteMachine = _macBridgeService.MacConnection.IpAddress;
pDebugTargets[0].bstrPortName = "4024";
pDebugTargets[0].bstrOptions = MinifyJson(LaunchConfig.GetConfig());
VsDebugTargetProcessInfo[] pLaunchResults = new VsDebugTargetProcessInfo[1];
_debugger4.LaunchDebugTargets4(1, pDebugTargets, pLaunchResults);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the launch.json symbolOptions and the Debug Adapter Host log, especially the setSymbolOptions request, then compare them with the remote vsdbg breakpoint response. Trace the IVsDebugger4 LaunchDebugTargets4 configuration and the .NET Core for Unix engine identified by its GUID. Done means determining why symbols are not loaded and how the debugger should be configured through launch.json or IVsDebugger4.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100