Closed avikenjale closed 8 years ago
See the same issue on Windows with following .NET CLI:
.NET Command Line Tools (1.0.0-rc2-002678)
Product Information:
Version: 1.0.0-rc2-002678
Commit Sha: 3b2ea9d14b
Runtime Environment:
OS Name: Windows
OS Version: 6.3.9600
OS Platform: Windows
RID: win81-x64
Are you using the version of the C# extension from the gallery? If so, you instead want to be using the more recent builds of the extension. See https://aka.ms/vscclrdogfood for instructions.
@gregg-miskelly not sure about the OP but I'm using the v1.0.5-rc2 extension. Think the main issue is I missed some info:
- If you are using brand new builds of the .NET CLI (ignore this unless you went out of your way to install the newest bits): The CLI will no longer drop a native host executable by default. Future versions of this extension will improve this process, but for now you want to --
- Set 'program' to the path to the 'dotnet' executable. You can find the path to dotnet using
which dotnet
(OSX/Linux) orwhere.exe dotnet.exe
(Windows).- Set the first element in 'args' to the path to the dll. Example:
"args": [ "bin/Debug/netstandard1.5/MyApplication.dll" ],
If you are using v1.0.5-rc2, you want to ignore the version of the documentation in the master branch. Instead look at https://aka.ms/vscclrdogfood.
@gregg-miskelly except that version of the debugger.md
file doesn't contain the information I needed (clipped above). It still mentions:
"program": "${workspaceRoot}/MyLaunchingProject/bin/Debug/netcoreapp1.0/MyLaunchingProject.dll",
@dougbu what are you looking for? That is what you want 'program' to look like as long as you are using a v1.* extension.
@dougbu , I tried as per your comment, however I am having logically same error as:
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "/usr/bin/dotnet",
"args": ["bin/Debug/netstandardapp1.5/hwAppCore2.dll"],
"cwd": "${workspaceRoot}",
"stopAtEntry": false
}
First I see Error: "The preLaunchTask 'build' terminated with exit code 1."
Then at Debug OUTPUT window: No executable found matching command "dotnet-bin/Debug/netstandardapp1.5/hwAppCore2.dll" The program '/usr/bin/dotnet' has exited with code 0 (0x00000000).
Which actually again says .dll file not expected.
@avikenjale what version of the C# extension, and .NET CLI are you using (dotnet --version
)?
.NET Command Line Tools (1.0.0-beta-001793)
Product Information:
Version: 1.0.0-beta-001793
Commit Sha: 42a0eec967
Runtime Environment:
OS Name: ubuntu
OS Version: 14.04
OS Platform: Linux
Runtime Id: ubuntu.14.04-x64
@gregg-miskelly I'm looking for something that works w/ RC2 bits. No path ending in .dll
works and having to type in the dotnet.exe
path is a hack. If something like "${env.Path}/dotnet.exe"
worked, that may suffice.
Admittedly "run"
is a fine argument. So at least I don't need the unique DLL path in my launch.json
file. (Pity dotnet run
doesn't support the --nobuild
argument.)
I suspect I could make an RC2 project work w/o the hack if I switched to spitting out a per-platform .exe
. But the shared runtime is our preference and the default.
@gregg-miskelly , Please let me know if more information required from my end.
@dougbu: As long as you are using recent .NET CLI, recent C# extension, and you want to host your code in the 'dotnet' process then -- you want 'program' to be the path to the dll. Don't use 'dotnet run' it cannot support debugging (beyond the build issue).
@avikenjale your .NET CLI build is a weird one. Is there a reason you are using that? There are a number of builds in that timeframe with broken debugging. I can't remember if that one works or not. I would recommend following one of the two known paths -- 1. the latest builds of the C# extension and the latest builds of the CLI (see https://aka.ms/vscclrdogfood) -or- 2. the C# extension from the gallery + the builds of the CLI as recommended in step 2 of master branch instructions.
@gregg-miskelly after rescuing my VS Code instance from a weird in-between state (thanks @DustinCampbell), I'm now really using v1.0.5-rc2
. Corrected the launch.json
file to use the path to the DLL and all is now well w.r.t. my system and this issue.
But the new state is a bit strange: Using the path to dotnet.exe
no longer works whether the arguments are run --framework netcoreapp1.0
or the path to the DLL. Why does that no longer work w/ the v1.0.5-rc2
extension?
@gregg-miskelly, I think I got my answer, per your link provided. Here it is mentioned under point If you are using the recomended builds of the .NET CLI under Once for each project about replacing 'osx...' and this is working at my end after modifying 'Program' field's path, exactly. Thanks !
However, still not sure about the demo on Channel 9 by John Kemnetz, 'Program' field set to '.dll' file from Debug and is working. Just curious.
@dougbu which one is latest or newest '1.0.0-rc2-002678' ,'1.0.0-beta-001793' or 'v1.0.5-rc2', My Ubuntu always showing me 1.0.0-beta-001793', Is that correct? May be my question is stupid or due to lack of proper information of frameworks/versions. Any link to understand?
v1.0.5-rc2
is the latest C# extension I know of.
1.0.0-preview1-002700
is the latest .NET CLI though 1.0.0-rc2-002678
is close. You may need to use a different package source to get that however (not sure). See https://github.com/dotnet/cli/tree/rel/1.0.0-preview1 for instructions.
@dougbu I don't know why 'dotnet run' would ever have worked. To my knowledge 'dotnet run' launches a child process, and this child process is where the code actually runs. Since we have no child process debugging support, 'dotnet run' can't work (unless of course one manually attaches to the right process).
@avikenjale in John's channel 9 video, he is using the 'daily build' approach ('1' from my previous reply). In this scenario, 'program' is set to the path of the dll.
any chance of revisiting this with released RC2 bits, latest version of VS Code and of C# extension? I'm getting the same errors reported above when attempting to debug in VSCode on OSX. "The preLaunchTask 'build' terminated with exit code 1." then choosing debug anyway and then it reports it the dll listed in my programm setting doesnt exist even though I'm using the exact path and see the file.
program '/Users/julialerman/Documents/MyEF7A/EF7WebAPI/src/bin/Debug/netcoreapp1.0/src.dll> does not exist
Here is the web section of launch.json. I think only program is relevant, but in case you need more, I'm pasting in the whole section.
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/src/bin/Debug/netcoreapp1.0/src.dll>",
"args": [],
"cwd": "${workspaceRoot}",
"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"
}
}
},
If you think I should open up a new issue, let me know. Thanks!
You seem to have '>' at the end of your program path.
well that's embarrassing. Detritus from the placeholder and a "not seeing the trees for the forest" oversight when I was starting at the code for too long .. so worried I had a typo in the path. After? LOL. And ...I am now debugging aspnetcore right inside of VS Code! Hooray!!! Thanks.
I wanna debug a program , throw an error:
The program '/Users/JCNetwork-Mecil9/HomeWork/C#/projectApp/bin/Debug/netcoreapp1.1/projectApp.dll' has exited with code 0 (0x00000000).
Is the same as the solution to this problem?
my launch.json file:
{
"version": "0.2.0",
"configurations": [{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/netcoreapp1.1/projectApp.dll",
"args": [],
"cwd": "${workspaceRoot}",
"externalConsole": false,
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command.pickProcess}"
}
]
}
i can see the correct results on the vscode's debug console view. thX
@Mecil9 you might want to open a new issue rather than adding comments to an already closed one. A few questions to answer in the new issue (assuming my questions don't help you figure things out yourself):
The program '/Users/JCNetwork-Mecil9/HomeWork/C#/projectApp/bin/Debug/netcoreapp1.1/projectApp.dll' has exited with code 0 (0x00000000).
just means that your program ran successfully.If you just want to have the debugger stop at the start of the program, you can set stopAtEntry
to true
.
I just now installed VS Code today and started a tutorial. When running F5 or Ctrl-F5 I was getting an error that the .dll was not valid. The fix was easy and was due to the default entry not having the full path.
@dmadden51 do you have an example project file that demonstrates this? What is happening is that the build system is building files to 'bin/HPD' but OmniSharp doesn't understand this and thinks the project is building to 'bin'. So I would be interested in understanding how your build system configures the output path.
something like this happened to me this past week on my Windows 10 hp laptop with a simple .NET console app. Thanks to @dmadden51 who put me on the "right path" (pun intended) for the fix
Example launch.json
below. I had to add the "MCD" path segments, which were not supplied by VS Code when I first tried to run in debug mode.
// 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 (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/MCD/Debug/netcoreapp2.0/calculator.dll",
"args": [],
"cwd": "${workspaceFolder}",
// 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}"
}
,
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/MCD/Debug/netcoreapp2.0/calculator.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
1. Setup: I have installed Visual Studio code on My Ubuntu and installed .NET Core and Mono.
2. Intial Configuration: I created a simple demo app running
notnet restore
anddotnet run
. This simply works fine and display "Hello World!" on terminal.3. Extension: To debug this, I installed extension of OmniSharp. and then using "Debugger" option of Visual Studio Code, I added launch.json & task.json.
4. launch.json (Only showing configuration section):
5. Now, when running from terminal it works fine, however when try to debug using option .NET Core Launch (console) I am getting following error:
"launch: The property 'program' is invalid. '/home/ak/dotnet_core/hwAppCore2/bin/Debug/netstandardapp1.5/hwAppCore2.dll' is a library (.dll), not a program."
I also followed one of Channel 9 demo, and there also I can see hwapp.dll configured for program property of launch.json
I am not sure, am I missing anything to configure?