Microsoft.VisualStudio.Project.ProjectNode.Dispose C# (CSharp) Method

Dispose() protected method

Disposes the project node object.
protected Dispose ( bool disposing ) : void
disposing bool Flag determining ehether it was deterministic or non deterministic clean up.
return void
        protected override void Dispose(bool disposing)
        {
            if (this.isDisposed)
            {
                return;
            }

            try
            {
                try
                {
                    this.UnRegisterProject();
                }
                finally
                {
                    try
                    {
                        this.RegisterClipboardNotifications(false);
                    }
                    finally
                    {
                        try
                        {
                            if (this.projectEventsProvider != null)
                            {
                                this.projectEventsProvider.AfterProjectFileOpened -= this.OnAfterProjectOpen;
                            }
                            if (this.taskProvider != null)
                            {
                                taskProvider.Tasks.Clear();
                                this.taskProvider.Dispose();
                                this.taskProvider = null;
                            }

                            if (this.buildLogger != null)
                            {
                                this.buildLogger.Shutdown();
                                buildLogger = null;
                            }

                            if (this.site != null)
                            {
                                this.site.Dispose();
                            }
                        }
                        finally
                        {
                            this.buildEngine = null;
                        }
                    }
                }

                if (this.buildProject != null)
                {
                    this.buildProject.ProjectCollection.UnloadProject(this.buildProject);
                    try { this.buildProject.ProjectCollection.UnloadProject(this.buildProject.Xml); }
              catch (Exception ex) { Trace.WriteLine("Exception : " + ex.Message); }
                    this.buildProject = null;
                }

                if (null != imageHandler)
                {
                    imageHandler.Close();
                    imageHandler = null;
                }
            }
            finally
            {
                base.Dispose(disposing);
                this.isDisposed = true;
            }
        }
ProjectNode