How to debug a VSPackage project

1.7k Views Asked by At

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

1

There are 1 best solutions below

0
On BEST ANSWER

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.