Example #1
0
        public void Dispose_MultipleTimes_Success()
        {
            CompositionHost host = CompositionHost.CreateCompositionHost(new ExportDescriptorProvider[0]);

            host.Dispose();
            host.Dispose();
        }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         _compositionHost.Dispose();
     }
 }
Example #3
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            _customToolRunner.Dispose();
            CompositionHost.Dispose();
        }
Example #4
0
        private void assertExportsAndDispose(MefComposer composer)
        {
            int         composedCount = 0;
            MefComposer lastComposer  = null;
            ComposerEventArgs <ContainerConfiguration> lastComposedEventArgs = null;

            composer.Composed += (s, e) =>
            {
                ++composedCount;
                lastComposer          = s as MefComposer;
                lastComposedEventArgs = e;
            };

            Assert.AreSame(composer.Compose(), lastComposedEventArgs.Target);
            Assert.AreEqual(1, composedCount);
            Assert.IsNotNull(lastComposedEventArgs);
            Assert.IsNotNull(lastComposedEventArgs.Target);
            Assert.IsNotNull(lastComposer);
            Assert.AreSame(composer, lastComposer);

            CompositionHost compositionHost = lastComposedEventArgs.Target.CreateContainer();
            List <IParent>  parts           = new List <IParent>(3);

            parts.AddRange(compositionHost.GetExports <IParent>());
            Assert.AreEqual(3, parts.Count);

            Helper.AssertValidParents(parts);
            composer.Dispose();
            Helper.AssertValidParents(parts);
            compositionHost.Dispose();
            Helper.AssertDisposedParents(parts);
        }
 private void Dispose(bool isDisposing)
 {
     if (isDisposing)
     {
         _compositionHost?.Dispose();
     }
 }
 /// <summary>
 ///   Disposes the resources used by this component factory.
 /// </summary>
 /// <param name="disposing">
 ///   if set to <c>false</c>, this method has been called by the runtime.
 /// </param>
 protected override void DisposeResources(bool disposing)
 {
     if (disposing && _container != null)
     {
         _container.Dispose();
         _container = null;
     }
 }
Example #7
0
 public void Dispose()
 {
     if (container != null)
     {
         container.Dispose();
         container = null;
     }
 }
        protected override void DisposeCore(bool disposing)
        {
            _serviceProvider.Dispose();
            _compositionHost.Dispose();

            this.LoggerFactory.Dispose();
            this.Workspace.Dispose();
        }
 public static void Cleanup()
 {
     if (CompositionHost != null)
     {
         CompositionHost.Dispose();
         CompositionHost = null;
     }
 }
        public void Dispose()
        {
            foreach (var plugin in _plugins)
            {
                plugin.OnShutdown();
            }

            _container.Dispose();
        }
Example #11
0
        void UnregisterServices()
        {
            if (_host == null)
            {
                return;
            }

            _host.Dispose();
        }
Example #12
0
        public void Dispose()
        {
            if (disposed)
            {
                return;
            }

            disposed = true;
            host.Dispose();
        }
Example #13
0
        public static void Cleanup()
        {
            if (CompositionHost != null)
            {
                CompositionHost.Dispose();
                CompositionHost = null;
            }

            InitialConfiguration.Clear();
        }
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (_host != null)
            {
                _host.Dispose();
                _host = null;
            }

            _container = null;
        }
Example #15
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            if (_container != null)
            {
                _container.Dispose();
                _container = null;
            }

            _container = null;
        }
 private static void Dispose()
 {
     if (!IsInitialized)
     {
         return;
     }
     _container.Dispose();
     _container     = null;
     _mockedObjects = new Dictionary <string, object>();
 }
Example #17
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    container.Dispose();
                }

                disposedValue = true;
            }
        }
Example #18
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            if (_container != null)
            {
                _container.Dispose();
            }
        }
Example #19
0
        public static void Dispose()
        {
            lock (_sync)
            {
                if (!IsInitialized)
                {
                    return;
                }

                _compositionHost.Dispose();
                _mocked = new Dictionary <string, object>();
            }
        }
Example #20
0
 public void Dispose()
 {
     _compositionHost?.Dispose();
     _loggerFactory?.Dispose();
     _cancellationTokenSource?.Dispose();
 }
Example #21
0
 public void Dispose()
 {
     _lighthandlerContainer?.Dispose();
 }
Example #22
0
 public void Dispose()
 {
     _container?.Dispose();
 }
Example #23
0
 public void TearDown()
 {
     _container.Dispose();
     _container = null;
 }