开发者

How to debug a VSPackage project

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜