且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检测是否调试

更新时间:2023-11-27 23:21:40

HttpContext 是另一种 HttpContext,因为您现在使用的是 ASP.NET Core.在 ASP.NET Core 变体中找不到该属性.给出了差异的解释.

HttpContext is another HttpContext than you were used to since you are now using ASP.NET Core. That property can't be found in the ASP.NET Core variant. An explanation of the differences is given by poke.

我会使用 Debugger.IsAttached,它不仅会检查是否启用了调试,还会被主动调试.

I would use Debugger.IsAttached, which not only checks if debugging is enabled, but also actively being debugged.