简体   繁体   English

如何增加允许 Visual Studio 无响应的时间?

[英]How do I increase the time Visual Studio is allowed to be unresponsive?

I am trying to develop an application in C# communicating via OData with Microsoft's Dynamics 365 for Finance and Operations solution.我正在尝试使用 C# 开发一个应用程序,通过 OData 与 Microsoft 的 Dynamics 365 for Finance and Operations 解决方案进行通信。 This uses a large (900,000+ lines) file produced by Microsoft's OData V4 Client Generator extension (V2.4.0).这使用了由 Microsoft 的 OData V4 Client Generator 扩展 (V2.4.0) 生成的大型(900,000 多行)文件。

Whenever I accidentally step into code in this file while debugging, or try to look at a definition in it (whether the application is running or not), or otherwise just open the file, Visual Studio 2017 (currently version 15.5.6) will become unresponsive and be restarted a few seconds later.每当我在调试时不小心进入这个文件中的代码,或者试图查看其中的定义(无论应用程序是否正在运行),或者只是打开文件,Visual Studio 2017(当前版本 15.5.6)将成为无响应并在几秒钟后重新启动。

Visual Studio 2015 used to start getting various panels no being refreshed and flickering as complete blank before it failed. Visual Studio 2015 曾经开始让各种面板在失败之前没有被刷新和闪烁为完全空白。 Visual Studio 2017 just locks up. Visual Studio 2017 只是锁定。

I have wondered if the timeout before it gets restarted could be increased, so that it has to complete whatever it's doing, assuming it will recover.我想知道它重新启动之前的超时是否可以增加,以便它必须完成它正在做的任何事情,假设它会恢复。

If anyone has another way to work with huge autogenerated files, I'd be willing to try them.如果有人有另一种方法来处理巨大的自动生成的文件,我愿意尝试它们。 Obviously, spending hours manually breaking up the file is not an option and my attempts to split the file into multiple files using partial classes simply wouldn't compile (as I recall, the error was that it ran out of string space - presumably, VS couldn't maintain all the cross-file information for over two thousand partial classes in its internal structures).显然,花费数小时手动分解文件不是一种选择,我尝试使用部分类将文件拆分为多个文件根本无法编译(我记得,错误是它用完了字符串空间 - 大概是 VS无法在其内部结构中维护两千多个部分类的所有跨文件信息)。

You can try to close the large file window immediately on opening to prevent Visual Studio from processing it.您可以尝试在打开时立即关闭大文件窗口,以防止 Visual Studio 处理它。 For example in a IVsRunningDocTableEvents.OnBeforeDocumentWindowShow handler:例如在IVsRunningDocTableEvents.OnBeforeDocumentWindowShow处理程序中:

public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, Microsoft.VisualStudio.Shell.Interop.IVsWindowFrame pFrame)
{
    try
    {
        if (GetDocumentName(docCookie).EndsWith(fileToBlock, System.StringComparison.CurrentCultureIgnoreCase))
            pFrame.CloseFrame((int)Microsoft.VisualStudio.Shell.Interop.__FRAMECLOSE.FRAMECLOSE_NoSave);
    }
    catch (System.Exception e)
    {
    }
    return Microsoft.VisualStudio.VSConstants.S_OK;
}

See Block certain file from opening in a document tab sample extension for Visual Commander.请参阅阻止某些文件在Visual Commander 的文档选项卡示例扩展中打开

Searching the forums on MSDN I was able to find a high number of people with the same issue you're reporting.在 MSDN 上搜索论坛,我找到了很多与您报告的问题相同的人。 The VS Development team said they've fixed those issues back in August 2017. VS 开发团队表示,他们已经在 2017 年 8 月修复了这些问题。

You could try to update Visual Studio and get the release with the fix or try disabling diagnostics tools and elapsed time PerfTip:您可以尝试更新 Visual Studio 并获取带有修复程序的版本,或者尝试禁用诊断工具和已用时间 PerfTip:

在此处输入图片说明

If your project is compatible with VS 2015, I'd suggest going back to it if you still have a working license.如果您的项目与 VS 2015 兼容,如果您仍有工作许可证,我建议您返回它。

Source:来源:

Slow IDE when Diagnostics Tools is turned on 诊断工具打开时 IDE 速度慢

Slow IDE when CodeLens is turned on 打开 CodeLens 时 IDE 速度慢

Slow IDE when fusion logging is turned on 打开融合日志时的 IDE 速度较慢

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

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