I can run from command line. But if I try to run in vscode, how to add parameter in launch.json? I am running on .dotnet 2.0
dotnet run --kestrelTransport Libuv
If running from vscode, how should I configure launch.json?
The demo launch.json is attached below.
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/Benchmarks.dll",
"args": [],
"cwd": "${workspaceFolder}",
"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": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
You can replace
"args": [],
with
"args": ["--kestrelTransport", "Libuv"],
Related
Here is the screenshot
I'm a newbie in R and Vsc. I installed all necessary extensions and I keep getting the error prompt [R path not working. "C:\Program Files\R\R-4.2.1\bin\R.exe"
(Can be changed in setting r.rpath.XXX)]. I increased the R debugger timeouts startup and I'm now getting the error prompt "Could not find function: main()" when I try to debug a code.
Even the simplest code "1+1" won't run. It only works in terminal. I need help please.
this is my launch.json
{
// 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": "R-Debugger",
"name": "Launch R-Workspace",
"request": "launch",
"debugMode": "workspace",
"workingDirectory": "${workspaceFolder}"
},
{
"type": "R-Debugger",
"name": "Debug R-File",
"request": "launch",
"debugMode": "file",
"workingDirectory": "${workspaceFolder}",
"file": "${file}"
},
{
"type": "R-Debugger",
"name": "Debug R-Function",
"request": "launch",
"debugMode": "function",
"workingDirectory": "${workspaceFolder}",
"file": "${file}",
"mainFunction": "main",
"allowGlobalDebugging": false
},
{
"type": "R-Debugger",
"name": "Debug R-Package",
"request": "launch",
"debugMode": "workspace",
"workingDirectory": "${workspaceFolder}",
"includePackageScopes": true,
"loadPackages": [
"."
]
},
{
"type": "R-Debugger",
"request": "attach",
"name": "Attach to R process",
"splitOverwrittenOutput": true
}
]
}
Pre-requisite: Firebase and node is setup correctly in the local machine
Requirements:
I only need to click the "Start Debugging (F5)" in VSCode once, then all other setup will be done automatically and I can start debugging.
When I change the code in editor during debugging, the change will be deployed and effective immediately
I can keep start and stop debugging session without worrying about process clean up because it's handled automatically after ending debugging session (Shift-F5)
You need only 2 files. Once they are in place, you can F5 to start debugging and Shift-F5 to stop debugging Firebase Functions.
{project_root}/.vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Debug",
"port": 9229,
"restart": true,
"skipFiles": ["<node_internals>/**"],
"preLaunchTask": "start firebase emulator",
"postDebugTask": "stop firebase emulator"
}
]
}
{project_root}/.vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "start firebase emulator",
"type": "shell",
"isBackground": true,
// (1) This autocompiles if there is any code change and effective immediately.
// (2) The single '&' ensures tsc -w (used in run build) will not block the emulator to start
// (3) --inspect-function allows debugger to be attached
"command": "npm --prefix ./functions run build -- -w & firebase emulators:start --inspect-functions",
"presentation": { "reveal": "silent", "close": true },
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"line": 1,
"column": 1,
"message": 1
}
],
"background": {
"activeOnStart": true,
"beginsPattern": { "regexp": "." },
"endsPattern": { "regexp": "." }
}
}
]
},
{
"label": "stop firebase emulator",
"command": "echo ${input:terminate}",
"type": "shell"
}
],
"inputs": [
{
"id": "terminate",
"type": "command",
"command": "workbench.action.tasks.terminate",
"args": "terminateAll"
}
]
}
I'm testing out ASP.NET Core using this tutorial: https://www.blinkingcaret.com/2018/03/20/net-core-linux/
When building and running from the terminal, both the CLI and Web app works fine:
Web app:
dotnet run
Using launch settings from /home/peter/Documents/dotnet_linux/Reminders.Web/Properties/launchSettings.json...
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using '/home/peter/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
Hosting environment: Development
Content root path: /home/peter/Documents/dotnet_linux/Reminders.Web
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
However from VS Code 1.28.1 I can only run the CLI app. When I add a configuration for the web app:
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/Reminders.Web/bin/Debug/netcoreapp2.1/Reminders.Web.dll>",
"args": [],
"cwd": "${workspaceFolder}/Reminders.Web/bin/Debug",
"stopAtEntry": false,
"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": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Reminders.Cli/bin/Debug/netcoreapp2.1/Reminders.Cli.dll",
"args": [],
"cwd": "${workspaceFolder}/Reminders.Cli",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
},
]
}
I get the error
This DLL does indeed exist.
I have looked through all config options for launch.json here: https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md but not found anything
You have an extra angle bracket.
Change
"program": "${workspaceFolder}/Reminders.Web/bin/Debug/netcoreapp2.1/Reminders.Web.dll>",
to
"program": "${workspaceFolder}/Reminders.Web/bin/Debug/netcoreapp2.1/Reminders.Web.dll",
I have VSCode version 1.18.1, and this in my Gruntfile.js
grunt.registerTask('release', 'Release process', function(target) {
...
}
The target is there so that I can run grunt release:one or grunt release:two. However, I can't figure out how to make VSCode run the task with the one|two target.
This is tasks.json file VSCode created with Grunt task auto detected.
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "grunt",
"task": "release",
"problemMatcher": [],
"label": "Release Process",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
If I put release:one to the task attribute of the tasks.json file, VSCode will complain with something like
Error: The grunt task detection didn't contribute a task for the following configuration:
Anyone has done something similar to this? Can you please guide me on how to do it?
Thank you!
The way I solved this issue myself was by creating a Task of type shell instead, and putting in the full command. For example, you can do following:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "Release one",
"command": "grunt release:one",
"problemMatcher": [],
}, {
"type": "shell",
"label": "Release two",
"command": "grunt release:two",
"problemMatcher": [],
}
]
}
I'm creating a solution with 2 projects. A class library and a console application to have the XUnit project. Both applications target .net 451 and .net core frameworks.
For the library I have
"netstandard1.3"
"net451"
For the xunit project I have
"netcoreapp1.0"
"net451"
I'm having problems when debugging the unit tests inside Visual Studio 2015, using the test explorer, when I try to debug, the symbols are not loaded.
Is there any setup for the projects that I'm missing? Any limitation in Visual Studio 2015 ?
I had this project and tests working fine only targeting .net core version. The problem started after introducing the net451 target.
Everything builds right and the tests also are discovered correctly.
Thanks in advance!
project.json from library project
"version": "1.0.4",
"files": {
"includeFiles": [
"Content/ReleaseNotes.txt"
],
"include": [
"../../README"
]
},
"releaseNotes": "Review ReleaseNotes.txt for details.",
"requireLicenseAcceptance": true
},
"buildOptions": {
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.ComponentModel.DataAnnotations": "",
"System.Data": "",
"System.Drawing": "",
"System.Drawing.Design": "",
"System.Transactions": "",
"System.Configuration": "",
"System.Configuration.Install": "",
"System.Management": "",
"System.Xml": "",
"System.Runtime": {
"type": "build"
}
},
"dependencies": {
"Google.Protobuf": "3.0.0-beta4"
}
},
"netstandard1.3": {
"buildOptions": {
"define": [ "NETCORE10" ],
"warningsAsErrors": false,
"embed": [
"keywords.txt",
"Resources.resx"
],
"resource": [ "**/*.resx" ],
"compile": {
"exclude": [
"Framework/Net451/**/*.*",
],
"includeFiles": [
"Resources.Designer.cs"
],
"excludeFiles": [
"Properties/VersionInfo.cs",
]
}
},
"dependencies": {
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"NETStandard.Library": "1.6.0",
"System.Collections.NonGeneric": "4.0.1",
"System.ComponentModel": "4.0.1",
"System.ComponentModel.Annotations": "4.1.0",
"System.ComponentModel.Primitives": "4.1.0",
"System.ComponentModel.TypeConverter": "4.1.0",
"System.Data.Common": "4.1.0",
"System.Data.SqlClient": "4.1.0",
"System.Diagnostics.Process": "4.1.0",
"System.Diagnostics.TextWriterTraceListener": "4.0.0",
"System.IO.Compression": "4.1.0",
"System.IO.FileSystem.Primitives": "4.0.1",
"System.IO.MemoryMappedFiles": "4.0.0",
"System.IO.Pipes": "4.0.0",
"System.Linq.Expressions": "4.1.0",
"System.Net.NameResolution": "4.0.0",
"System.Net.Security": "4.0.0",
"System.Net.Sockets": "4.1.0",
"System.Reflection": "4.1.0",
"System.Reflection.TypeExtensions": "4.1.0",
"System.Security.Principal.Windows": "4.0.0",
"System.Text.Encoding.CodePages": "4.0.1",
"System.Threading.Timer": "4.0.1",
"System.Threading.ThreadPool": "4.0.10",
"Google.Protobuf": "3.0.0-beta4"
}
}
}
}
project.json from xunit project
{
"version": "7.0.4",
"description": "MyLibrary",
"packOptions": {
"requireLicenseAcceptance": true
},
"buildOptions": {
},
"testRunner": "xunit",
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"xunit": "2.2.0-*",
"MyLibrary": {
"target": "project"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dnxcore50"
],
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-*",
"type": "platform"
}
},
"buildOptions": {
"define": [ "NETCORE10" ],
"copyToOutput": [ "appsettings.json" ],
"compile": {
"include": [ "../*.cs" ],
"exclude": [
"**/._*",
"Framework/Net451/**/*.*"
],
"excludeFiles": [
"TestDataTable.cs"
]
},
"warningsAsErrors": false,
"optimize": true
}
},
"net451": {
"frameworkAssemblies": {
"System.Collections": {
"type": "build"
},
"System.Diagnostics.Debug": {
"type": "build"
},
"System.Linq": {
"type": "build"
},
"System.Reflection": {
"type": "build"
},
"System.Reflection.Extensions": {
"type": "build"
},
"System.Runtime": {
"type": "build"
},
"System.Runtime.Extensions": {
"type": "build"
},
"System.Threading.Tasks": {
"type": "build"
}
},
"buildOptions": {
"compile": {
"exclude": [
"Framework/NetCore10/*.*"
],
"excludeFiles": [
"Framework/Net451/PerfMonTests.cs",
"Framework/Net451/ReplicationTests.cs"
]
}
}
}
}
}
Well, hope this save some time to someone else. I'm sort of new to the xproj projects and also still learning about all the options inside the new project.json file.Which I like so far. That said here's the answer to this particular issue.
I had an optimize = true outside the frameworks section which applies to all the configurations in the project. So the IDE was never generating the debug-able code. A good practice for this is having a configurations section in your project.json file where you define how you want the build to behave for each case.
And here is the configurations section that I added.
"configurations": {
"Debug": {
"buildOptions": {
"define": [ "DEBUG" ],
"optimize": false,
"preserveCompilationContext": true
}
},
"Release": {
"buildOptions": {
"define": [ "RELEASE" ],
"optimize": true,
"preserveCompilationContext": true,
"xmlDoc": true
}
}
And that's it.