简体   繁体   English

调试从 C++ 调用的 C# dll(嵌入 Z5D9B47BD3B65072E0D6ZDAF55F01DA08)

[英]Debug a C# dll called from C++ (with Mono embedded)

I have a runtime written in C++ (with Mono embedded) which calls functions in a dll written in C# using mono_jit_exec and mono_runtime_invoke . I have a runtime written in C++ (with Mono embedded) which calls functions in a dll written in C# using mono_jit_exec and mono_runtime_invoke . The glue code is generated with CppSharp - which I don't think is relevant here, but just to mention.胶水代码是用CppSharp生成的——我认为这里不相关,只是提一下。

So far all good, I can communicate in both directions.到目前为止一切都很好,我可以双向交流。

What I want now is to debug the C# code only, using Visual Studio (I'm using the version 2019 on macOS).我现在想要的是仅使用 Visual Studio 调试 C# 代码(我在 macOS 上使用的是 2019 版)。 So in my C# project, I went to Run Configuration and selected the Start external program option pointing to my C++ assembly.所以在我的 C# 项目中,我去运行配置并选择了指向我的 C++ 程序集的启动外部程序选项。 After that, I've set some breakpoints, but when I run the C# project in Debug mode, they're never triggered.之后,我设置了一些断点,但是当我在调试模式下运行 C# 项目时,它们永远不会被触发。

Why is not working - is there something else that needs to be done?为什么不起作用 - 还有其他需要做的事情吗? Is it because Mono is involved?是因为涉及到Mono吗?

Ok, so the answer is that is currently not supported.好的,所以答案是目前不支持。

A workaround would be to do remote debugging using a plugin for Visual Studio or Visual Studio Code, as Unity does .一种解决方法是使用 Visual Studio 或 Visual Studio Code 的插件进行远程调试,就像Unity 一样

One available extension is VS Code Mono Debug , which is based on the SDB: Mono Soft Debugger Client .一个可用的扩展是VS Code Mono Debug ,它基于SDB: Mono Soft Debugger Client

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM