Visual Studio Troubleshooting Extensions with the Activity Log

One of the most powerful tools for troubleshooting issues that involve Visual Studio extensions is often overlooked, even though it has been around for quite some time (since VS 2005). Anyone wondering what Visual Studio is doing with their VS Package, Extension, MEF Component, or pkgdef file should ask the IDE for an activity log. In this article, I will show you not only how to generate an activity log file for Visual Studio, but also highlight some of the things you can find in it.

It’s important to note that this applies not only to the Visual Studio 2010 IDE, but also to applications built using the Visual Studio 2010 Shell (Isolated) (or Integrated). All of the examples will assume the case of Visual Studio running under 32-bit Windows 7. For other cases, substitute the appropriate file locations and names and registry root key.

Creating the Activity Log

This is as easy as it sounds. Here is the magic incantation required to generate a visual studio activity log file:

LogCommand

In this case, I’ve started a command prompt and navigated to the folder where the Visual Studio executable is installed before typing “devenv /log”.

The same command could also be given:

  • from the Visual Studio Command Prompt (2010)
  • using the full path to the executable ("C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe") from either a command prompt under Start - Accessories or in the Start – Rundialog
  • on Windows 7, just by hitting the Windows key and typing “devenv /log” in the search box.

Finding the Activity Log

If “/log” is specified without adding an output path, the file is written to

%APPDATA%\Microsoft\VisualStudio\10.0\ActivityLog.xml

%APPDATA% resolves to “C:\Users\user\AppData\Roaming

In previous releases of Visual Studio, there was a required parameter to /log that specified the full path for the output file. In VS 2010, this path is optional. You might find it useful to direct the log file to an easier to find location, such as the desktop:

devenv /log c:\users\user\desktop\activitylog.xml

Reading the Activity Log

Once you have reached the point in Visual Studio that you are trying to troubleshoot, it’s a good idea to close Visual Studio. Otherwise, it will continue to write to the log while you are trying to read it.

Notice that the log file is generated as XML. When Visual Studio starts writing the log, it also writes a corresponding XSL file next to the XML file that makes it easy to read in Internet Explorer. Go ahead and browse to the file’s location and double-click on it.

LogSample

At the top of the file is a summary of how many lines of “infos” (sic), “warnings”, and “errors” are listed. Below that are the actual log items, which have up to 7 columns of information.

columndescription
#sequential item number
Typeblank for information, “Warning” (highlighted in yellow), or “Error” (highlighted in red)
Descriptionthe activity, which may optionally include a registry or file path
GUIDassociated GUID, typically for a VS Package
HrHRESULT value that may be useful for troubleshooting
Sourcemodule writing the log item
Time (UTC)timestamp for the item in UTC (not local) time

Activity Log Items

The activity log is full of more information than can adequately be addressed in any detail by a single blog post. However, several activities are worth noting:

  • Version of Visual Studio and .NET Framework
  • Configuration and state information about the pkgdef cache
  • If the pkgdef cache is found to be out-of-date, each discovered pkgdef file is listed, as it is parsed and loaded
  • Each VS Package that is loaded, including success and failure
  • Each VS Extensions loaded through the Extension Manager and whether it is enabled
  • Each MEF Component loaded and whether it came from the cache
  • Each category exported by the Profile manager

Summary

Those are the basics for creating, finding, and reading the Visual Studio Activity Log. Hopefully, this will give you a powerful tool for troubleshooting issues with VS Packages, VS Extensions, MEF Components, and pkgdef files. Try running Visual Studio with /log and see what useful insights you gain into what Visual Studio is doing.

转自:http://blogs.msdn.com/b/visualstudio/archive/2010/02/24/troubleshooting-with-the-activity-log.aspx

One example is https://social.msdn.microsoft.com/Forums/vstudio/en-US/089d0e1a-579d-4cfa-b5e3-c9a739b9d412/unexpected-system-error-mode-before-loading-package-visual-studio-xml-editor-package?forum=vssetup

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Optimize Windows system reliability and performance with Sysinternals IT pros and power users consider the free Windows Sysinternals tools indispensable for diagnosing, troubleshooting, and deeply understanding the Windows platform. In this extensively updated guide, Sysinternals creator Mark Russinovich and Windows expert Aaron Margosis help you use these powerful tools to optimize any Windows system’s reliability, efficiency, performance, and security. The authors first explain Sysinternals’ capabilities and help you get started fast. Next, they offer in-depth coverage of each major tool, from Process Explorer and Process Monitor to Sysinternals’ security and file utilities. Then, building on this knowledge, they show the tools being used to solve real-world cases involving error messages, hangs, sluggishness, malware infections, and much more. Windows Sysinternals creator Mark Russinovich and Aaron Margosis show you how to: Use Process Explorer to display detailed process and system information Use Process Monitor to capture low-level system events, and quickly filter the output to narrow down root causes List, categorize, and manage software that starts when you start or sign in to your computer, or when you run Microsoft Office or Internet Explorer Verify digital signatures of files, of running programs, and of the modules loaded in those programs Use Autoruns, Process Explorer, Sigcheck, and Process Monitor features that can identify and clean malware infestations Inspect permissions on files, keys, services, shares, and other objects Use Sysmon to monitor security-relevant events across your network Generate memory dumps when a process meets specified criteria Execute processes remotely, and close files that were opened remotely Manage Active Directory objects and trace LDAP API calls Capture detailed data about processors, memory, and clocks Troubleshoot unbootable devices, file-in-use errors, unexplained communication, and many other problems Understand Windows core concepts that aren’t well-documented elsewhere Table of Contents PART I: GETTING STARTED Chapter 1 Getting started with the Sysinternals utilities Chapter 2 Windows core concepts Chapter 3 Process Explorer Chapter 4 Autoruns PART II: USAGE GUIDE Chapter 5 Process Monitor Chapter 6 ProcDump Chapter 7 PsTools Chapter 8 Process and diagnostic utilities Chapter 9 Security utilities Chapter 10 Active Directory utilities Chapter 11 Desktop utilities Chapter 12 File utilities Chapter 13 Disk utilities Chapter 14 Network and communication utilities Chapter 15 System information utilities Chapter 16 Miscellaneous utilities PART III: TROUBLESHOOTING—“THE CASE OF THE UNEXPLAINED…” Chapter 17 Error messages Chapter 18 Crashes Chapter 19 Hangs and sluggish performance Chapter 20 Malware Chapter 21 Understanding system behavior Chapter 22 Developer troubleshooting
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值