Build .NET 6 Mobile Apps with MVU style UI with Comet
Debug experience
- Build and launch the app on the emulator
- Locals, Stacks, breakpoints, etc.
- Supports Android and iOS/MacCatalyst (macOS only)
- Powershell Core
- Node (npm)
- Typescript:
npm install -g typescript
- VSCE (to package VSIX):
npm install -g vsce
- .NET 6 Preview with Android/iOS/Catalyst workloads (Install
dotnet tool install -g redth.net.maui.check
and runmaui-check
to ensure your environment is setup correctly) - Mono (mac only)
- VSCode on Mac must have the
"omnisharp.useGlobalMono": "never"
setting to properly load net6.0 projects!
- Clone repo recursively
git clone --recursive [email protected]:clancey/vscode-comet.git
pwsh build.ps1 build
npm i
- Debug the extension (there's an Extension launch profile already setup in launch.json), and open up a .NET 6 project in the new VS Code instance being debugged.
- Create a
.vscode/launch.json
file (The Debug tab has a "Create launch .json file" button which can help - choose 'Comet for .NET Mobile' from the list):
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "comet",
"request": "launch",
"preLaunchTask": "comet: Build"
}
]
}
- Choose a Startup Project from the status bar menu.
- Choose a Device from the status bar menu.
- Start debugging!
- Open the
./src/mobile-debug/mobile-debug.sln
in Visual Studio - Set the startup / debug args to
--server
(this tells the mobile-debug.exe process to listen on 4711 socket instead of expecting stdin/out for communication with VSCode extension) - Start debugging mobile-debug.exe
- Open vscode-comet in VSCode and debug the Extension launch profile which already exists in launch.json. This will open a new instance of VSCode with the Comet extension loaded (being debugged by the first VSCode instance).
- Load a valid project (ie:
dotnet new maui
) in the second instance of VSCode - Follow the steps in the section above (Debugging a .NET Mobile app with the Extension) to setup a
launch.json
for the project. - Before you start debugging, add the following setting to your launch.json:
"debugServer": 4711,
(this tells VSCode to connect to the 4711 socket which your mobile-debug.exe process is listening on now, as opposed to launching mobile-debug.exe directly itself and using stdio). - Start debugging your app from the second VSCode instance.
- You should be able to hit breakpoints and see the VSCode instance connect to the mobile-debug.exe running process which you are debugging from Visual Studio.