CentOS系统下MonoDevelop 7.4调试.NET Core 2.0应用断点失效求助
Hey David, let's walk through why your breakpoints aren't hitting in MonoDevelop 7.4 when debugging .NET Core 2.0 on CentOS, and what you can do about it.
First off, this isn't exactly a straight-up bug—but it's definitely related to incomplete support for .NET Core 2.0 debugging in that specific MonoDevelop version. When MonoDevelop 7.4 launched, .NET Core 2.0 was still relatively new, and the Linux debugging integration for .NET Core was still being refined. The breakpoint functionality for .NET Core wasn't fully polished in that release, especially on CentOS.
Let's go through actionable steps to get breakpoints working:
- Double-check your build configuration: Make sure you're building in
Debugmode, notRelease. Release mode optimizes code heavily, which can erase breakpoints entirely. You can switch this in MonoDevelop's top toolbar or in your project's properties under "Build". - Enable .NET Core debugging in settings: Head to
Edit > Preferences > Debuggerand look for the .NET Core section. Ensure "Enable .NET Core debugging" is checked. If you don't see this option, your MonoDevelop installation might be missing the required debugging components—reinstalling a version with full .NET Core support could help. - Update Mono and .NET Core SDK: Outdated versions can cause compatibility issues. For MonoDevelop 7.4, aim for Mono 5.x (the stable branch at the time) and make sure you have the latest .NET Core 2.0 SDK patch installed on CentOS.
- Override the debug launch command: Instead of relying on MonoDevelop's default launch, manually set the debug command to
dotnet run --configuration Debugin your project's debug settings. Sometimes the IDE's automatic launch skips the breakpoint detection step. - Validate your breakpoint placement: Avoid setting breakpoints on lines with no meaningful logic (like empty methods or constant returns)—even Debug mode might optimize these out. Test with a line that has actual code execution (e.g., a variable assignment or a method call).
If none of the above fixes breakpoints, consider these workarounds:
- Upgrade to a newer MonoDevelop version (8.x or later)—subsequent releases had massive improvements to .NET Core debugging on Linux.
- Switch to Visual Studio Code with the official C# extension—it's had far more robust .NET Core debugging support on Linux since early .NET Core versions.
内容的提问来源于stack exchange,提问作者davvid

