Closes the VSPackage, releases cached interface pointers, and unadvises event sinks.
Assembly: Microsoft.VisualStudio.Shell.Interop (in Microsoft.VisualStudio.Shell.Interop.dll)
This method will clean up any external references and break any reference counting cycles. After all VSPackages' methods have been called, the environment releases all proffered services.
The following semantics should be adhered to in the implementation of Method:
Once a VSPackage is loaded, it will not be unloaded until the environment application ends. If one VSPackage method is being called, then every VSPackage method is called. This means a given VSPackage handles its own shutdown and cleanup requirements.
The VSPackage will clean up all external references. The Close method is intended to break all reference counting cycles and to encourage all reference counts to eventually reach zero. You should release cached interface pointers, unadvise event sinks, and provide other necessary cleanup duties. VSPackages must be sure to honor all reference counts. A VSPackage cannot delete objects when the method is called.
All services of the environment and all loaded VSPackages remain accessible during the method implementation. The VSPackage, however, must expect that the services are unavailable and that the only methods that are guaranteed to succeed are unadvise methods. Most services are expected to fail, to advise new event sinks, or to create new resources.
A VSPackage should not call the RevokeService method in its implementation of the method. All services are expected to remain available for the duration of calling Close on VSPackages. The environment automatically revokes and releases the services after VSPackages have called .
It is meaningless to return an error from . All error Return Values are ignored and the environment completes the shutdown process once it has started. The VSPackage has an opportunity to stop the shutdown process in its QueryClose method.
If a package needs to block shutdown of the IDE it should implement IVsPackage2.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.