简体   繁体   English

C#Visual Studio启动调试器时挂了很长时间

[英]C# Visual Studio Hanging for a Long Time When Starting Debugger

My Winforms app has a reference to a local DLL file called MyUtilities.dll. 我的Winforms应用程序引用了一个名为MyUtilities.dll的本地DLL文件。 Whenever I start debugging my app after making ANY code change and it reaches the point where it uses a method inside MyUtilities.dll to make a network call to a remote SOAP API, VS hangs for about 90 seconds and when I try to click anywhere inside VS, it brings up the popup that says it's "Loading symbols for MyUtilities.dll". 每当更改任何代码后开始调试我的应用程序时,只要达到使用MyUtilities.dll中的方法对远程SOAP API进行网络调用的程度,VS就会挂起大约90秒钟,并且当我尝试单击内部的任何位置时VS,它弹出显示“正在为MyUtilities.dll加载符号”的弹出窗口。

Here's where it gets interesting: 这是有趣的地方:

  1. The PDB file is not encrypted with EFS. PDB文件未使用EFS加密。
  2. Just My Code debugging is enabled. 仅“我的代码”调试已启用。
  3. I've even added MyUtilities.dll to the exclusion list. 我什至将MyUtilities.dll添加到了排除列表。
  4. The CPU usage doesn't really spike when it's hanging. 挂起时,CPU使用率并没有真正上升。
  5. I've tried to use Process Monitor (procmon) to watch the activity, and I don't see anything unusual, but I might be looking at the wrong thing... 我曾尝试使用Process Monitor(procmon)来监视活动,但没有发现任何异常,但是我可能看错了东西...
  6. I've loaded Fiddler at the same time to see if it's a long remote API call but the SSL handshake and network call don't even begin until the ~90 seconds is finished, and the actual API call comes back in under 1 second. 我同时加载了Fiddler,以查看它是否是一个较长的远程API调用,但是SSL握手和网络调用直到〜90秒结束才开始,并且实际的API调用在不到1秒的时间内返回。
  7. I've tried copying the DLL file to a different folder on an SSD and referencing it from there, but it doesn't make a difference. 我尝试将DLL文件复制到SSD上的其他文件夹中,然后从那里引用它,但这没有什么区别。
  8. If I start/restart the debugger again without any code changes, it does not freeze. 如果我在没有任何代码更改的情况下再次启动/重新启动调试器,它将不会冻结。

Now, AFTER it resumes running, I can see in the output that it didn't load the symbols): 现在,在它恢复运行之后,我在输出中看到它没有加载符号):

'MyApp.exe' (blah blah): Loaded 'C:\...\bin\Debug\MyUtilities.dll'. Loading disabled by Include/Exclude setting.

Any ideas on what could be causing the freeze? 关于什么可能导致冻结的任何想法? I'm running VS 2017 Community. 我正在运行VS 2017社区。

Figured it out. 弄清楚了。 After some more analysis in Process Monitor, I noticed entries for "MAILSLOT\\NET\\NETLOGON" like: 在Process Monitor中进行更多分析之后,我注意到“ MAILSLOT \\ NET \\ NETLOGON”的条目如下:

11:21:04    CreateFile    \\MYPC*\MAILSLOT\NET\NETLOGIN    SUCCESS
11:21:04    WriteFile     \\MYPC*\MAILSLOT\NET\NETLOGIN    BAD NETWORK PATH
11:21:17    CloseFile     \\MYPC*\MAILSLOT\NET\NETLOGIN    SUCCESS

Based on that, I found this StackOverflow question: Visual studio 2012 slow unit testing 基于此,我发现了这个StackOverflow问题: Visual Studio 2012缓慢的单元测试

...which led me to this article: https://social.technet.microsoft.com/Forums/windowsserver/en-US/20eb50e9-3e68-4d29-bcdd-a4fc166b9c00/adlds-very-slow-roundtrip-to-servermailslotnetnetlogon?forum=winserverDS ...导致我读到这篇文章: https : //social.technet.microsoft.com/Forums/windowsserver/zh-CN/20eb50e9-3e68-4d29-bcdd-a4fc166b9c00/adlds-very-slow-roundtrip-to- servermailslotnetnetlogon?forum = winserverDS

End Result: Go into each network adapter, go to its properties, go into the Internet Protocol Version 4 (TCP/IPv4) properties, go to Advanced -> WINS and disable NetBIOS over TCP/IP. 最终结果:进入每个网络适配器,进入其属性,进入Internet协议版本4(TCP / IPv4)属性,进入“高级”->“ WINS”并禁用TCP / IP上的NetBIOS。

After doing that, everything works perfectly (didn't even need to reboot). 完成之后,一切正常(甚至不需要重新启动)。

暂无
暂无

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

相关问题 为解决方案中的多个 Visual Studio 2012 C# 项目启动调试器时出现 Visual Studio 2017 警告错误 - Visual Studio 2017 warning errors when starting a debugger for multiple Visual Studio 2012 C# projects in a solution 在Visual Studio社区2017中启动C#控制台应用程序时未安装调试器 - Debugger Not Installed While Starting C# Console App in Visual Studio Community 2017 用于C#的Visual Studio调试器的乘法问题 - Multiplication issue with Visual Studio debugger for C# 在 Visual Studio/C# 中不挂起的无限 while/for 循环 - Infinite while/for loop without hanging in visual studio/C# 在C#解决方案中时,Visual Studio 2008调试器错误地将C ++显示为语言 - Visual Studio 2008 Debugger incorrectly shows C++ as the language when in C# solution C# 在 Visual Studio 调试器中运行项目或运行构建的可执行文件时,HtmlAgilityPack 的行为不同 - C# HtmlAgilityPack behaves differently when running project in Visual Studio debugger or when running a built executable 如何在C#中发生处理异常时停止Visual Studio调试器 - How to make the Visual Studio debugger stop when a handled exception occurs in C# 当 Visual Studio 调试器评估值时,我可以让我的 C# 代码在断点处停止吗? - Can I make my C# code stop at breakpoint when Visual Studio debugger is evaluating the value? 仅使用Visual Studio在C#中的某个时间点开始调试 - Starting debugging only from a certain point in time in C# with Visual Studio Visual Studio 2010:单元测试:调试器未启动 - Visual Studio 2010: Unit Test: Debugger not starting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM