简体   繁体   English

无法调试在Autofac中注册的Singleton的构造函数

[英]Unable to debug constructors of Singleton registered with Autofac

For some reaon, my breakpoints within constructors and pretty much all the functions of a type registered as SingleInstance() within Autofac are not hit. 对于某些原因,构造函数中的断点以及在Autofac中注册为SingleInstance()的类型的几乎所有功能都没有受到影响。 If I remove SingleInstance() registration and leave it per request then debugging works fine. 如果我删除SingleInstance()注册并根据请求保留它,则调试可以正常进行。

I don't want to remove the SingleInstance registration just to be able to debug my stuff. 我不想删除SingleInstance注册只是为了能够调试我的东西。

Is there any way to do it and why does it happen like so in the first place? 有什么办法可以做到,为什么它会首先发生呢?

Write below command in your code wherever you want the debugger to be attached. 要将调试器连接到任何地方,请在代码中编写以下命令。

Reference: MSDN 参考: MSDN

 System.Diagnostics.Debugger.Launch();

It works just like browser developer tools debugger while debugging javascript. 它在调试javascript时就像浏览器开发人员工具调试器一样工作。

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

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