bevyengine / bevyengine/bevy

Unable to run bevy application via VSCode debug UI

Open
#2,589 18 comments 0 reactions 0 assignees View on GitHub
C-Bug S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.5.0

## Operating system & version

Windows 10 Pro Build 19043.1110

## What you did

- Followed first time set up using: https://bevyengine.org/learn/book/getting-started/setup/
- Set `rustflags = ["-Zshare-generics=off"]` in `.cargo/config.toml` as per the following issue:
https://github.com/bevyengine/bevy/issues/1126#issuecomment-750000945
- Build via terminal command: `cargo build`
- Create the following `.vscode/launch.config`:
```
{
// 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": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/target/debug/game-test.exe", // Adjust exe name appropriately on your machine
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"console": "internalConsole"
}
],
}
```
- Create the following `src/main.rs`:
```
use bevy::prelude::*; // The presence of this line triggers the issue

fn main() {
println!("hello world!");
}
```
- Attempt to run using the VSCode Debugger UI, selecting the launch configuration we created above

## What you expected to happen

Starting the executable via cppvsdbg debugger in VSCode should complete successfully with no error.

## What actually happened

The following error is reported in Debug Console:
`The program '[10184] game-test.exe' has exited with code -1073741515 (0xc0000135).`

It seems like the application terminates early due to missing modules.

I opened [Process Monitor](https://docs.microsoft.com/en-us/sysinternals/downloads/procmon) whilst running the application via VSCode debug to see what binaries were getting linked into the application. It seems that the following file is missing under all search paths: `std-92c1680604aea3a5.dll`.

So I ran again, this time using `cargo run`, which I know works fine. This time, the missing dll was correctly found at:
`\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib\std-92c1680604aea3a5.dll`.

So this suggests that my `.vscode/launch.json` is missing some vital pathing to the toolchain target std lib.

My rust and cargo knowledge is extremely limited, as is my vscode knowledge to be fair. If I were to guess, I would say that the launch configuration is not providing enough pathing information to the loading binary, whereas cargo run does provide this. So I think there may be a missing step in the Bevy docs to get debugging working - I'm just not sure what it is yet.

Anyone else able to repro this?

## Additional information

Running the application via `cargo run` works fine - in fact, it should be noted that I can get started learning Bevy using this method, however, I'd very much like to get debugging working.

Manually running the executable from CMD or by double clicking the exe yields the following error:
![game-test-runtime-error](https://user-images.githubusercontent.com/12872500/127925707-c282f881-3590-41dd-97ef-8637133536ec.png)

Manually running from the VSCode terminal yields nothing (actually I think maybe the stdout is routed somewhere weird, so best not to read too much into that).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.