为Visual Studio Enterprise 2019引入时间旅行调试

The Time Travel Debugging (TTD) preview in Visual Studio Enterprise 2019 provides the ability to record a Web app running on a Azure Virtual Machine (VM) and then accurately reconstruct and replay the execution path. TTD integrates with our Snapshot Debugger offering and allows you to rewind and replay each line of code however many times you want, helping you isolate and identify problems that might only occur in production environments.

Visual Studio Enterprise 2019中的时间旅行调试(TTD)预览功能提供了录制在Azure虚拟机(VM)上运行的Web应用程序的功能,然后可以准确地重建和重播执行路径。 TTD与我们的Snapshot Debugger产品集成在一起,使您可以按需要多次回放和重播每行代码,从而帮助您隔离和识别仅在生产环境中可能出现的问题。

This article in blog 博客中的这篇文章

The most effective type of debugging often occurs in what we call the “inner loop”. While you’re in the act of reviewing and debugging code locally, before you’ve pushed to version control. The problems we encounter during inner loop development are usually easier to understand and diagnose because they are accessible and repeatable.

最有效的调试类型通常发生在我们所谓的“内部循环”中。 在进行版本控制之前,当您在本地检查和调试代码时。 我们在内循环开发过程中遇到的问题通常更容易理解和诊断,因为它们是可访问且可重复的。

Today, we’re excited to announce the release of the Time Travel Debugging (TTD) in Visual Studio Enterprise. With TTD, we are giving you the power to record code executed in production and replay the execution path inside Visual Studio. TTD also gives you the ability to move forward and backwards in time as if you were performing “inner loop” debugging locally. You also get access to important debugging features like locals and the call stack.

今天,我们很高兴宣布Visual Studio Enterprise中的时间旅行调试(TTD)版本。 使用TTD,我们可以记录生产中执行的代码并在Visual Studio中重播执行路径。 TTD还使您能够及时向前和向后移动,就好像您在本地执行“内部循环”调试一样。 您还可以访问重要的调试功能,例如本地语言和调用堆栈。

Today’s debuggers typically allow you to stop at a specific breakpoint by halting the entire process and then only move forward. Even with a more advanced debugging tool like IntelliTrace, you record events and data at discrete moments in time. TTD has a significant advantage over snapshots, logging or crash dump files, as these methods are generally missing the exact details of the execution path that led up to the final failure or bug.

当今的调试器通常允许您停止整个过程,然后再继续前进,从而在特定的断点处停止。 即使使用IntelliTrace之类的更高级的调试工具 ,您也可以在不连续的时刻记录事件和数据。 与快照,日志记录或故障转储文件相比,TTD具有显着优势,因为这些方法通常缺少导致最终失败或错误的执行路径的确切细节。

什么是时间旅行调试? (What is the Time Travel Debugging?)

Time Travel Debugging (TTD) is a reverse debugging solution that allows you to record the execution of code in an app or process and replay it both forwards and backwards. TTD improves debugging since you can go back in time to better understand the conditions that lead up to a specific bug. Additionally, you can replay it multiple times to understand how best to fix the problem. TTD technology was recently introduced in a preview version of WinDbg for native code scenarios.

时间旅行调试(TTD)是一种反向调试解决方案,它使您可以记录应用程序或进程中代码的执行情况,并向前和向后回放它们。 TTD改进了调试功能,因为您可以及时返回以更好地了解导致特定错误的条件。 此外,您可以重播多次以了解如何最好地解决该问题。 最近,在本机代码方案的WinDbg预览版中引入了TTD技术

We have extended the Snapshot Debugger with TTD to allow you to record your applications as it executes. That recording can then be played back in Visual Studio 2019 Enterprise where you can rewind and replay each line of code as many times as you want. TTD records on the thread that matches the snappoint conditions and will generally run until the end of the method. If there is an “await” after the snappoint but before the end of the method, we will stop recording where the await occurs. This feature will be in preview for the release of Visual Studio 2019 with a go live license. We plan to add more TTD scenarios in future updates.

我们使用TTD扩展了快照调试器 ,以允许您在应用程序执行时对其进行记录。 然后可以在Visual Studio 2019 Enterprise中回放该录音,您可以在其中回放和回放每行代码任意多次。 TTD会在与快照点条件匹配的线程上进行记录,并且通常会一直运行到方法结束。 如果在快照点之后但在方法结束之前存在“等待”,我们将停止记录发生等待的位置。 具有实时许可证的Visual Studio 2019版本将在预览中使用此功能。 我们计划在将来的更新中添加更多的TTD方案。

TTD入门 (Getting started with TTD)

The Time Travel Debugging preview can be enabled in the latest version of Visual Studio Enterprise 2019 for Azure Virtual Machines on the Windows OS running ASP.NET (4.8+).

可以在运行ASP.NET(4.8+)的Windows操作系统上针对Azure虚拟机的最新版本的Visual Studio Enterprise 2019中启用时间旅行调试预览。

After installing the latest version of Visual Studio Enterprise, complete the following steps:

安装最新版本的Visual Studio Enterprise之后,请完成以下步骤:

1. Open the project you would like to Time Travel Debug – ensure that you have the same version of source code that is published to your Azure Virtual Machine.

1.打开您想要进行时间旅行调试的项目–确保您具有与发布到Azure虚拟机的源代码相同的版本。

2. Choose Debug > Attach Snapshot Debugger and select the Azure Virtual Machine your project is deployed to along with an Azure storage account. You will be required to install the Snapshot Debugger site extension the first time an attach is attempted.

2.选择“ 调试”>“附加快照调试器”,然后选择将项目与Azure存储帐户一起部署到的Azure虚拟机。 首次尝试连接时,将需要安装Snapshot Debugger网站扩展。

3. Select the Time Travel Debugging option and then click Attach. Once Visual Studio is in Snapshot Debugger mode it will be capable of recording using TTD.

3.选择“ 时间旅行调试”选项,然后单击“ 附加” 。 一旦Visual Studio处于快照调试器模式,它将能够使用TTD进行记录。

4. Create a snappoint and configure it to enable time travel debugging. Click Start\Update Collection.

4.创建一个快照点并将其配置为启用时程调试。 单击开始\更新集合

5. Once your Snapshot has been collected click on View Snapshot and you can use the command bar to step forwards and backwards within the recorded method.

5.收集快照后 ,单击“ 查看快照”,然后可以使用命令栏在记录的方法中前进和后退。

()
TTD预览限制 (TTD preview limitations)

During the initial preview stage of TTD we will be supporting AMD64 Web apps running on a Azure Virtual Machine (VM). We expect that recording will add significant overhead to your running process, slowing it down based on process size and the number of active threads. We also anticipate a degraded debugging experiences in some of the following scenarios: –

在TTD的初始预览阶段,我们将支持在Azure虚拟机(VM)上运行的AMD64 Web应用程序。 我们希望记录会为您正在运行的进程增加大量开销,并根据进程大小和活动线程数减慢其速度。 我们还预计在以下某些情况下会降低调试体验:–

  • During a GC compacting phase.

    在GC压缩阶段。
  • Stepping through an optimized method e.g. when you step into a method that does not contain a snappoint.

    逐步执行优化的方法,例如,当您进入不包含快照点的方法时。
  • If your application internally loads or unloads app domains.

    如果您的应用程序在内部加载或卸载应用程序域。
  • Recording only occurs on the thread that was triggered by the snappoint, code that subsequently impacts alternate threads will also be degraded.

    记录仅发生在由快照点触发的线程上,随后影响备用线程的代码也将降级。

Please Note: we will also not record the async causality chains.

请注意:我们也不会记录异步因果关系链。

During preview testing we found that the TTD file sizes ranged from several hundred megabytes up to several gigabytes depending on how long your session lasts and how long the web app runs. However, files created by TTD will be cleaned up once the Snapshot Debugger session ends, and an app pool recycle is initiated. For our preview release we also recommend using a VM with a minimum of 8GB RAM.

在预览测试期间,我们发现TTD文件的大小从几百兆字节到几千兆字节不等,具体取决于会话持续的时间和Web应用程序运行的时间。 但是,一旦Snapshot Debugger会话结束并且启动了应用程序池回收,将清除TTD创建的文件。 对于我们的预览版,我们还建议使用至少8GB RAM的VM。

立即尝试TTD! (Try out TTD now!)

We are incredibly excited about how this preview feature can help enhance your debugging experiences in Azure, but this is just the beginning. Our team continues to design and build additional TTD capabilities that we plan to add in upcoming Visual Studio releases.

我们对于此预览功能如何帮助您增强Azure中的调试体验感到非常兴奋,但这只是开始。 我们的团队将继续设计和构建其他TTD功能,我们计划在即将发布的Visual Studio版本中添加这些功能。

We are counting on your feedback via our Developer Community and the Feedback Hub, you can help us prioritize what improvements to make because we genuinely value all the responses you provide.

我们希望通过我们的开发者社区和反馈中心获得您的反馈,因为我们真正重视您提供的所有反馈,因此可以帮助我们确定需要改进的优先级。

Avatar
马克·唐尼 (Mark Downie)

Program Manager, Visual Studio Production Diagnostics

Visual Studio生产诊断程序经理

翻译自: https://habr.com/en/company/microsoft/blog/448778/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值