如何调试 VSPackage 项目

发布于 2024-10-14 19:59:43 字数 804 浏览 1 评论 0原文

我安装了 VS2010 SDK 并创建了一个 VSPackage 项目,其中包含一个空的“Initialize”方法。

[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[Guid(GuidList.guidGrowl_Extras_VSAddInPkgString)]
public sealed class Growl_Extras_VSAddInPackage : Package
{
   public Growl_Extras_VSAddInPackage()
   {
      Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
   }

protected override void Initialize()
   {
      Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
      base.Initialize();
   }
} 

如果我在“Initialize”方法中设置断点并在调试模式下运行项目,它将启动实验性 VS 实例,但断点不会命中。它说没有加载调试符号。

我做错了什么?

感谢您的帮助, 恩尼拉

I installed the VS2010 SDK and created a VSPackage project, with an empty "Initialize" method.

[PackageRegistration(UseManagedResourcesOnly = true)]
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
[Guid(GuidList.guidGrowl_Extras_VSAddInPkgString)]
public sealed class Growl_Extras_VSAddInPackage : Package
{
   public Growl_Extras_VSAddInPackage()
   {
      Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString()));
   }

protected override void Initialize()
   {
      Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
      base.Initialize();
   }
} 

If I set a break point within the "Initialize" method and run the project in debug mode, it starts the experimental VS instance, but the breakpoint does not hit. It says no debug symbols loaded.

What am I doing wrong?

Thanks for help,
Enyra

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鱼窥荷 2024-10-21 19:59:43

这是完全正常的行为。 Visual Studio 尝试将您的包加载到内存中,除非确实有必要。 (例如,用户打开了项目类型或执行了包提供处理的命令。)

这种延迟加载是出于性能原因而完成的。如果 VS 在启动时加载了所有扩展和包,那么每次启动 IDE 时您都会等待相当长的时间。

MSDN 上的此页面提供了更详细的说明。

根据您发布的代码片段,您的包没有注册(通过 Provide* 属性)它具有任何功能,因此 Visual Studio 从来没有真正的理由加载它。

This is entirely normal behavior. Visual Studio attempts to not load your package into memory until it absolutely has to. (For example, a user opened a project type or executed a command that your package provides handling for.)

This delay-loading is done for performance reasons. If VS loaded all the extensions and packages at startup, you would be waiting quite a while longer than needed on each start of the IDE.

This page on MSDN explains in further detail.

Based on the code snippet you posted, your package doesn't register (via Provide* attributes) that it has any features, so Visual Studio never has a real reason to load it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文