【发布时间】:2016-08-25 22:13:33
【问题描述】:
我创建了一个小型 C# 库原型,它有一个 Invoke 函数。
public class TestClass
{
public async Task<object> Invoke(dynamic input)
{
Dictionary<Type, IReport> reports = new Dictionary<Type, IReport>
{
{typeof (LevelOne), new LevelOneReport()},
{typeof (LevelTwo), new LevelTwoReport()}
};
ILevel toTestLevel1 = new LevelOne(1);
ILevel toTestLevel2 = new LevelTwo(2);
IReport report = reports[toTestLevel2.GetType()];
return report.Generate(toTestLevel2);
}
}
函数的结果是一个新对象,其中有一个int。我已在我的 node/electron/edge.js 应用程序中确认数据已成功从 C# dll 传递到我的应用程序。 (即 C# 代码和 JavaScript 可以像我期望的那样协同工作。)
由于这是一个更复杂系统的原型,我希望能够将 Visual Studio 调试器附加到节点(或电子?)进程,让它加载 C# dll 的调试符号文件并允许我根据 Edge.js 文档单步执行我的 C# dll(请参阅the github page here)。我已将 C# dll 和 .pdb 文件复制到电子应用程序目录。
因此,我在 Visual Studio 的 C# 类中设置了一个断点,然后将调试器附加到“托管”node.exe 进程。我注意到的第一件事是有两个 node.exe 进程正在运行,这两个进程都没有文档中提到的“托管”描述。
我尝试先附加到一个,然后附加到另一个,但在我的 edge.js 调用 C# dll 函数后,我的断点无法命中。我检查了 Debug->Windows->Modules 并看到实际上没有加载任何模块。沮丧的是,我将调试器附加到电子进程(具有“托管”描述),我的 C# dll 突然出现,并在 Debug->Windows->Modules 页面中加载了符号!唉,我的断点还没被命中。
有谁知道是否有办法让 Visual Studio 中的调试器实际附加到节点/电子应用程序并允许在关联的 C# dll 中进行详细调试?
【问题讨论】:
标签: javascript c# node.js visual-studio-debugging edge.js