I would like to use teams toolkit to debug my app locally.
Documentation mention here the I only should run F5 than launch chrome debug to roll out all the steps.
In my case doing this only create a Launch.json file and open localhost address in the browser.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "edge",
"version": "stable",
"request": "launch",
"name": "Lancer Edge en utilisant localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
But according to documentation it should open teams web app.
Am I missing a step ?
Here's also a video explaining the debug process.
Is your app created by Teams Toolkit?
Only the apps created by Teams Toolkit are supported to debug locally. Follow the video you mentioned to have a try.
We have created the app using Teams Toolkit and the launch.json and task.json are created.
After running the app it goes to Edge browser and teams web app is loaded.
You need to change the url in configuration of launch.json file.
In your code its "http://localhost:8080" so its redirecting to it.
You need to change it to "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}"
Refer the below launch.json code:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Remote (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 1
}
},
{
"name": "Launch Remote (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${teamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"presentation": {
"group": "remote",
"order": 2
}
},
{
"name": "Launch Bot (Edge)",
"type": "pwa-msedge",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Launch Bot (Chrome)",
"type": "pwa-chrome",
"request": "launch",
"url": "https://teams.microsoft.com/l/app/${localTeamsAppId}?installAppPackage=true&webjoin=true&${account-hint}",
"cascadeTerminateToConfigurations": [
"Attach to Bot"
],
"presentation": {
"group": "all",
"hidden": true
}
},
{
"name": "Attach to Bot",
"type": "pwa-node",
"request": "attach",
"port": 9239,
"restart": true,
"presentation": {
"group": "all",
"hidden": true
}
}
],
"compounds": [
{
"name": "Debug (Edge)",
"configurations": [
"Launch Bot (Edge)",
"Attach to Bot"
],
"preLaunchTask": "Pre Debug Check & Start All",
"presentation": {
"group": "all",
"order": 1
},
"stopAll": true
},
{
"name": "Debug (Chrome)",
"configurations": [
"Launch Bot (Chrome)",
"Attach to Bot"
],
"preLaunchTask": "Pre Debug Check & Start All",
"presentation": {
"group": "all",
"order": 2
},
"stopAll": true
}
]
}
Related
I am trying to create a launch.json file for the following repo:
https://github.com/zakariamofaddel/shopify-nextjs-template
I have tried both the default VS Code node template and the NextJs launch file.
VS code default Node generated .vscode/launch.json file
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\server\\index.ts"
}
]
}
I am able to run yarn dev successfully and use console.log:
https://github.com/zakariamofaddel/shopify-nextjs-template/blob/38c700d8706818aa12d892b3f1193a969919e003/package.json#L9
I found the solution after adding the TypeScript Debugger extension in VS code.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Localhost",
"type": "node",
"request": "launch",
"args": [
"${workspaceRoot}\\server\\server.ts"
],
"runtimeArgs": [
"-r",
"ts-node/register/transpile-only"
],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart",
"env": {
"NODE_ENV": "development"
}
}
]
}
Where can I find an example of the .NET Core Launch (Blazor Standalone) launch configuration? And before you refer me to this https://learn.microsoft.com/en-us/aspnet/core/blazor/debug?tabs=visual-studio-code&view=aspnetcore-3.1#vscode I have already been there. No actual example of the configuration file is present.
I struggled with this too; Just debug with ".Net Core" should be first choice; should auto generate:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (Blazor Standalone)",
"type": "coreclr",
"request": "launch",
"program": "dotnet",
"args": [
"run"
],
"cwd": "${workspaceFolder}/src/Project.UI",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
{
"name": ".NET Core Debug Blazor Web Assembly in Chrome",
"type": "pwa-chrome",
"request": "launch",
"timeout": 30000,
"url": "https://localhost:5001",
"webRoot": "${workspaceFolder}/src/Project.UI",
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}"
}
]
}
You need to create a build task (task.json) first for the blazor WebAssembly
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/BlazorSVgTest.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
]
}
And then create a launch task (launch.json) with debug enabled
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/BlazorSVgTest.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
]
}
Okay, after revisiting this I now understand. in the launch.json I needed to add a line for "url": "https://localhost:{PORT}" and use the first port mentioned in Properties/launchSettings.json.
To get the browser to open I added "browser": "edge" but it does not automatically open the page so I do still need to manually navigate to the url but I can live with that. If anyone figured out how to get the working feel free to share. My launch.json looks like the following:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch and Debug Standalone Blazor WebAssembly App",
"type": "blazorwasm",
"request": "launch",
"url": "https://localhost:7051",
"browser": "edge"
}
]
}
I am using Visual Studio Code on macOS for developing Flutter apps.
I can select a single device in the bottom-left of VSC. I can also run on multiple devices using flutter run -d all. I am wondering how I can run on multiple devices using the debug console in VSC. Or, at the very least, debug one device but show updates on all.
Thank you
If you're on recent versions of Flutter and the Dart/Flutter extensions (Dec 2019 onwards) this is now supported using VS Code's compound launch configurations.
Your .vscode/launch.json should contain an entry for each device, along with its deviceId (this is the ID you would pass to flutter run -d xxx):
{
"version": "0.2.0",
"configurations": [
{
"name": "Current Device",
"request": "launch",
"type": "dart"
},
{
"name": "Android",
"request": "launch",
"type": "dart",
"deviceId": "android"
},
{
"name": "iPhone",
"request": "launch",
"type": "dart",
"deviceId": "iphone"
},
],
"compounds": [
{
"name": "All Devices",
"configurations": ["Android", "iPhone"],
}
]
}
For more information, see https://github.com/flutter/flutter/wiki/Multi-device-debugging-in-VS-Code.
How about this one, it worked for me
flutter run -d all
well you can run only two devices or two virtual machine at the same time
one using command flutter run -d <put the id of the device>
and the other using f5 and choose the other device
In Flutter 1.12 support multi device debugging in VS Code
https://github.com/flutter/flutter/wiki/Multi-device-debugging-in-VS-Code
If you have different flavors, you can configure your launch.json config as follows.
{
"version": "0.2.0",
"configurations": [
// config "Run Dev Android" and "Run Dev Iphone" will be user for multiple debuging,
{
"name": "Run Dev Android",
"request": "launch",
"deviceId": "SM",
"type": "dart",
"program": "lib/app/flavors/main_development.dart",
"flutterMode": "debug",
"args": [
"--flavor", "development",
]
},
{
"name": "Run Dev Iphone",
"flutterMode": "debug",
"deviceId": "Iphone",
"program": "lib/app/flavors/main_development.dart",
"type": "dart",
"args": [
"--flavor", "development",
]
},
{
"name": "Run Dev",
"program": "lib/app/flavors/main_development.dart",
"flutterMode": "debug",
"deviceId": "Android",
"type": "dart",
"args": [
"--flavor", "development",
]
},
{
"name": "Run Stage",
"program": "lib/app/flavors/main_staging.dart",
"flutterMode": "debug",
"type": "dart",
"args": [
"--flavor", "staging"
]
},
{
"name": "Run Prod",
"program": "lib/app/flavors/main_development.dart",
"flutterMode": "release",
"type": "dart",
"args": [
"--flavor", "production"
]
},
],
"compounds": [{
"name": "All Devices",
"configurations": ["Run Dev Android", "Run Dev Iphone"],
}]
}
Now you can select the All Device and hit run.
In How to implement `au run --watch` task + debugging Ashley Grant outlines nicely a method (along with other contributors) to launch a browser while debugging in VS Code, but as evident in comments, it appears source mapping doesn't work. Indeed, I got going with that post, but as being a rather n00b with both VS Code and Aurelia, I wonder if anyone has ideas what could make it working? Currently I have only JS code, but that or TypeScript helpers and pointers are appreciated.
Just in case, here is the
tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "au",
"isShellCommand": true,
"tasks": [
{
"taskName": "watch",
"suppressTaskName": true,
"args": [
"run",
"--watch"
],
"isBuildCommand": false,
"isBackground": true,
"problemMatcher": {
"owner": "au",
"severity": "info",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "__________",
"file": 1
},
"watching": {
"activeOnStart": true,
"beginsPattern": "^File Changed: (.*)",
"endsPattern": "/(?:BrowserSync Available At:)|(?:Finished 'reload')"
}
}
}
]
}
and here is the launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:9002",
"webRoot": "${workspaceRoot}",
"preLaunchTask": "watch"
},
{
"type": "chrome",
"request": "attach",
"name": "Attach to Chrome",
"port": 3003,
"webRoot": "${workspaceRoot}"
},
{
"type": "firefox",
"request": "launch",
"name": "Launch Firefox against localhost",
"url": "http://localhost:9002",
"webRoot": "${workspaceRoot}",
"preLaunchTask": "watch"
},
{
"type": "firefox",
"request": "attach",
"name": "Attach to Firefox",
"port": 3003,
"webRoot": "${workspaceRoot}"
}
]
}
Not sure if this is what you are looking for, but this is the only way I got working to debug JavaScript in an Aurelia application with VSC.
Works only with Chrome, no luck with Firefox so far.
A JavaScript file must be open and it must be the active editor in VSC for the debugger to use the right path. Breakpoints will work (only) for all JavaScript files in that same directory.
Command line:
au run --watch
launch.json:
"configurations": [
{
"type": "chrome",
"request": "launch",
"sourceMaps": true,
"trace": true,
"name": "Aurelia App in Chrome (for currently open JavaScript file)",
"url": "http://localhost:9000/index.html",
"webRoot": "${fileDirname}/.."
},
...
I loaded the yeoman generator-meanjs and opened it with Visual Studio Code.
The debugger works nicely. When I clicked on the debug side bar button a
launch.json file was generated for me. The launch.json generator is looking at the package.json which has "scripts": { "start": "grunt"}.
The generator uses grunt to launch the application. The launch.json file had
the following:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "node",
"request": "launch",
"program": "grunt",
"stopOnEntry": false,
"args": [],
"cwd": ".",
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy"
],
"env": {
"NODE_ENV": "development"
},
"externalConsole": false,
"sourceMaps": false,
"outDir": null
},
{
"name": "Attach",
"type": "node",
"request": "attach",
"port": 5858
}
]
}
When I replace 'program' : 'grunt' with server.js it works. If I could change the type to grunt, but it seems only node or mono is supported there.
I managed to make it work by using an absolute path to grunt-cli, as follows:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Grunt",
"args": ["build"],
"program": "${env.APPDATA}\\npm\\node_modules\\grunt-cli\\bin\\grunt",
"stopOnEntry": true,
"cwd": "${workspaceRoot}"
}
]
}
As pointed by #L.Butz, on newer vscode versions, replace env.APPDATA by env:APPDATA.