Hi I have the following state:
The cargo rust project: /Users/daniel1302/www/aws-alarm/
The workspace dir: `/Users/daniel1302/www
I have the following debugging configuration:
{
"type": "lldb",
"request": "launch",
"name": "rust/aws-alarm",
"cwd": "/Users/daniel1302/www/aws-alarm/",
"cargo": {
"args": [
"build",
"--lib"
],
},
"program": "${cargo:program}",
"args": [],
"env": {
"AWS_PROFILE": "sf_MFA",
"AWS_REGION": "us-east-1"
},
}
When I am starting the project debugging I can see:
Running `cargo build --lib --message-format=json`...
error: could not find `Cargo.toml` in `/Users/daniel1302/www/releases` or any parent directory
The issue is, that cwd directive does not change the project directory.
Do you know How can I change the cargo project directory?
I have found workaround by setting cargo arg --manifest-path:
"configurations": [
{
...
"cargo": {
"args": [
"build",
"--bin=importer",
"--package=cprices",
"--manifest-path=${workspaceFolder}/cprices/Cargo.toml"
],
...
Related
I use the vscode to debug my code, my code can run but it can't start debugging.
my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "C++ Launch (GDB)",
"type": "cppdbg",
"request": "launch",
"targetArchitecture": "x86",
"program": "${file}.exe",
"miDebuggerPath": "D:\\VisualStudioCode\\mingw\bin\\gdb.exe",
"args": [
"blackkitty",
"1221",
"# #"
],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"externalConsole": true,
"preLaunchTask": "g++"
}
]
}
Try deleting the .vscode file in your project directory, and then rerun it, with me it worked perfectly
I am using the Erlang language plugin for vscode. I created a new rebar3 app and created a simple app that doesnt use a supervisor:
-module(test_app_app).
-behaviour(application).
-export([start/2, stop/1]).
start(_StartType, _StartArgs) ->
load_file("input.txt").
stop(_State) ->
ok.
load_file(Filename) ->
case file:read_file(Filename) of
{ok, Bin} ->
Bin;
{error, Reason} ->
erlang:error(Reason)
end.
I have configured a launch.json file like so:
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch erlang",
"type": "erlang",
"request": "launch",
"cwd": "${workspaceRoot}",
"arguments": "-s test_app_app start",
"preLaunchTask": "rebar3 compile"
}
]
}
and a tasks.json for the compile:
{
"version": "2.0.0",
"tasks": [
{
"label": "rebar3 compile",
"type": "shell",
"command": "rebar3 compile",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$erlang"
}
]
}
When I hit F5 I get the following output:
compiling erlang bridge to '/home/peter/.vscode/extensions/pgourlain.erlang-0.8.1/_build/default/lib/ebin'
Compiling arguments file "/tmp/bp_1454870.erl"
Compile result: sucess
Module bp_1454870 loaded
{"init terminating in do_boot",{undef,[{t
est_app_app,start,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({undef,[{test_app_app,start,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]})
Crash dump is being written to: erl_crash.dump...
done
erl exit code:1
erl exit with code 1
Does anyone have a clue as to why this isnt working for me?
The problem is in your launch.json. You try to run a function start/0 from module test_app_app and such function does not exist.
Try to use
"arguments": "-eval \"application:start(test_app)\""
I need to setup an auto restart when some source code file modifies.
I'm using VS Code with Dotnet Core 3.1 to develop a web api.
When debug starts I can see my REST Api published in http://localhost:5001/api/entities, but if I change a model or something else, I need to restart the debug to see the changes.
I've tried to start the project with dotnet watch run on terminal and attatch the debug to process, but I would like to know if is possible to config something in the project to start all debugs with dotnet watch enabled.
I know this an old question, but I found a solution.
I used Marco's solution and added this to my tasks.json:
"options": {
"cwd": "${workspaceFolder}/yourproject/"
}
So the final solution is :
tasks.json
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/yourproject/yourproject.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile",
"options": {
"cwd": "${workspaceFolder}/yourproject/"
}
}
launch.json
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "watch",
"program": "${workspaceFolder}/yourproject/bin/Debug/net5.0/yourproject.dll",
"args": [],
"cwd": "${workspaceFolder}/yourproject",
"stopAtEntry": false
}
Yes this is totally possible.
In VS Code, open your tasks.json, which should be located in the .vscode folder.
In there you should find a tasks array.
The easiest way is to simply add "watch" to just edit the build task:
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"build",
"${workspaceFolder}/delete.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
Since "build" is the default task, when pressing F5 and startig debugging, this will always start a dotnet start build, when debugging. The key takeaway is to add watch into the args array.
If you want to have a dedicated task for that, you can add one in the tasks.json:
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/delete.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
And in your launch.json you can set this task as the preLaunchTask:
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "watch",
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.0/delete.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false
}
]
I have created a small test project using dotnet new console to try this out locally, hence the delete.dll filename. Please make amendments as neccesary.
shameless plug, i've forked and updated dotnet auto attach vs code extension & made it to my liking dotnet watch
None of my breakpoints are active when debugging my serverless based application in VSCode.
launch.json
{
"configurations": [
{
"console": "integratedTerminal",
"cwd": "${workspaceRoot}",
"name": "Debug",
"port": 5858,
"request": "launch",
"runtimeArgs": [
"run-script",
"vscode:debug"
],
"runtimeExecutable": "npm",
"type": "node"
}
],
"version": "0.2.0"
}
My package.json
...
"scripts": {
...
"vscode:debug": "export SLS_DEBUG=* && node --inspect=5858 --debug-brk --nolazy ./node_modules/.bin/serverless invoke local -s local -f customerAlexa -p ./test/requests/FindAgent-First-GoodZip.json"
},
....
When I choose Start Debugging from the menu, all the red breakpoints go grey and the program just executes without stopping on the breakpoints.
I am running Node 6.11.2, Serverless 1.23.0 on a Mac. Thanks all.
Here is my launch.json which allows me to use breakpoints.
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceRoot}/node_modules/.bin/serverless",
"args": [
"offline",
"start",
"--skipCacheInvalidation"
],
"env": {
"NODE_ENV": "development"
}
}
I am using the serverless-offline to run locally. I also am using webpack and babel. The skipCacheInvalidation is for that.
I hope this points you in the right direction.
I'm trying to debug a dotnet core project on OSX and keep getting a reference error that it cant find the required library.
A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/Chris/Google Drive/Repos/project/src/project.api/bin/Debug/netcoreapp1.0'.
WARNING: The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use Microsoft.NETCore.App 1.0.0 or newer. This may be expected if the target process did not run .NET code.
The program '/Users/Chris/Google Drive/Repos/project/project.api/src/project.api/bin/Debug/netcoreapp1.0/project.api.dll' has exited with code 131 (0x00000083).
So I looked in the bin directory and noticed there's an additional directory under netcoreapp1.0 called osx.10.11-x64.
In my launch.json if I add that manually to the program path everything works - I was just wondering if that's normal and if the runtime could be picked up dynamically so I don't have to change the program path for different machines I work on (windows, nix, osx)
Here's a copy of launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/src/project.api/bin/Debug/netcoreapp1.0/osx.10.11-x64/project.api.dll",
"args": [],
"cwd": "${workspaceRoot}",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceRoot}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command.pickProcess}"
}
]
}