/// <summary>
 /// Enables Debug logging if a debugger is attached.
 /// </summary>
 public static void EnableDebugger()
 {
     __isDebugEnabled = true;
     if ((Debugger.IsAttached) && (__container != null))
     {
         __debugger = new IoCDebugger(__container);
     }
 }
 /// <summary>
 /// Resets the container instance to null to support testing with multiple configurations in the same unit test batch.
 /// </summary>
 public static void ResetContainer()
 {
     if (__debugger != null)
     {
         __debugger.Close();
     }
     __debugger  = null;
     __container = null;
 }
        internal static bool TryGetOrCreateContainer(Func <CompositionContainer> createContainer, out CompositionContainer globalContainer)
        {
            bool alreadyCreated = true;

            if (__container == null)
            {
                CompositionContainer container = createContainer();
                using (__lock.ForWrite())
                {
                    if (__container == null)
                    {
                        Thread.MemoryBarrier();
                        __container    = container;
                        alreadyCreated = false;
                        if ((Debugger.IsAttached) && (__isDebugEnabled))
                        {
                            __debugger = new IoCDebugger(__container);
                        }
                    }
                }
            }
            globalContainer = __container;
            return(alreadyCreated);
        }