/// <summary>
 /// Free resources associated with this instance - allows customization in extending types
 /// </summary>
 /// <param name="disposing">True if the data should be disposed - differentiates from IDisposable call</param>
 public virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _telemetry?.Flush();
         _telemetry?.Dispose();
         _telemetry = null;
         _logger?.Dispose();
         _logger = null;
         _deferredEvents?.Dispose();
         _deferredEvents = null;
     }
 }
        /// <summary>
        /// Free resources associated with this instance - allows customization in inheriting types
        /// </summary>
        /// <param name="disposing">True if the data should be disposed - differentiates from IDisposable call</param>
        public virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_telemetryEvents != null)
                {
                    _telemetryEvents.Clear();
                    _telemetryEvents = null;
                }

                if (_logger != null)
                {
                    _logger.Dispose();
                    _logger = null;
                }

                if (_warningMessages != null)
                {
                    string message;
                    while (_warningMessages.TryDequeue(out message))
                    {
                        ;
                    }
                    _warningMessages = null;
                }

                if (_debugMessages != null)
                {
                    string message;
                    while (_debugMessages.TryDequeue(out message))
                    {
                        ;
                    }
                    _debugMessages = null;
                }
            }
        }