Vscode-cpptools: Debug UWP applications

Created on 15 Aug 2020  路  4Comments  路  Source: microsoft/vscode-cpptools

Type: Debugger

Describe the bug

  • OS and Version: Windows 10 (2004)
  • VS Code Version: 1.48.0
  • C/C++ Extension Version: 0.30.0-insiders2
  • Other extensions you installed (and if the issue persists after disabling them): CMake Tools 1.4.1
  • A clear and concise description of what the bug is.

I would like to develop UWP applications in VS Code using Cpptools and CMake. As it currently stands UWP apps throw an exception before reaching "main".

To Reproduce
Try building the CoreApp sample of Coderox and debug.

Additional context
Some of my trial and error has been captured in this issue on Coderox's repo.

Feature Request debugger

Most helpful comment

For a launch scenario, there is work for VS Code C++ extension to launch the UWP app with debugging enabled.

See Automate UWP Launch for more information. This would also require it to be used with DebuggingEnabled.

However, if you manually deploy the the UWP app, you should be able to use the attach to process launch.json configuration to attach to the process.

All 4 comments

For a launch scenario, there is work for VS Code C++ extension to launch the UWP app with debugging enabled.

See Automate UWP Launch for more information. This would also require it to be used with DebuggingEnabled.

However, if you manually deploy the the UWP app, you should be able to use the attach to process launch.json configuration to attach to the process.

@WardenGnaw Thank you for your answer.

  • Attaching to a process is clumsy (requires inserting waiting on std::cin for instance to halt the app until attach happens) and isn't the fastest edit-build-debug loop out there.
  • The launcher app seems like a viable workaround, it does demonstrate the need of rituals and incantations around UWP that turns developers down.

    • _(I'm trying to compile the "Hello, World!" of UWP console apps to give a cross-platform library a UWP front-end without installing suites of tools which are otherwise alien to the existing cross-platform workflow. The material you linked is useful, but do understand that they are snippets from more fleshed out programs (not complete int main()s in and of themselves), moreover they are written in different dialects (one is ATL, one is C++/CX) and my work starts with writing CMake scripts for compiling the snippets and reverse engineering the required surrounding code to make them actually build and run. It's just more tax.)_

    • _(The COM launcher app does raise the immediate question of how to debug with command-line arguments, as the Accepting arguments part of the linked material suggests to modify the OnActivated function, which doesn't exist in UWP console apps. Does __argc and __argv macros or the pre-main UWP CRT parts take care of that? My launcher app has argc and argv but IApplicationActivationManager::ActivateApplication has a single LPCWSTR arguments argument which is documented as "A pointer to an optional, app-specific, argument string.". Am I to concatenate my argv list of strings here to pass it in from my Win32 main to the UWP main for debugging with CLI args?)_

When you say "there is work for VS Code C++ extensions..." does that mean?

  1. There is a way for the C++ extension to launch UWP apps as described below...
  2. There is ongoing internal work to debug UWP apps more easily (without manual deploy/attach or separate trampoline COM apps).

When you say "there is work for VS Code C++ extensions..." does that mean?

This would be scenario 1. There is a lot of work required to get C++ UWP deployment + debugging to working in VS Code. However, the main focus for the C++ debugger is cross platform scenario.

Unless there is a large demand for this feature to be in VS Code, we recommend using Visual Studio for UWP C++ debugging.

Please mark the top issue comment with a 馃憤 to vote for this feature.

When you say "there is work for VS Code C++ extensions..." does that mean?

This would be scenario 1. There is a lot of work required to get C++ UWP deployment + debugging to working in VS Code. However, the main focus for the C++ debugger is cross platform scenario.

Unless there is a large demand for this feature to be in VS Code, we recommend using Visual Studio for UWP C++ debugging.

Please mark the top issue comment with a 馃憤 to vote for this feature.

Our team are evaluating Flutter for Windows. Debug through the Dart part is quite a pleasure. Looking forward to debug C++ part as well.

Thumbed up

Was this page helpful?
0 / 5 - 0 ratings