public Hub(SentryOptions options) { Debug.Assert(options != null); _options = options; if (options.Dsn == null) { if (!Dsn.TryParse(DsnLocator.FindDsnStringOrDisable(), out var dsn)) { const string msg = "Attempt to instantiate a Hub without a DSN."; options.DiagnosticLogger?.LogFatal(msg); throw new InvalidOperationException(msg); } options.Dsn = dsn; } options.DiagnosticLogger?.LogDebug("Initializing Hub for Dsn: '{0}'.", options.Dsn); _ownedClient = new SentryClient(options); ScopeManager = new SentryScopeManager(options, _ownedClient); _integrations = options.Integrations; if (_integrations?.Length > 0) { foreach (var integration in _integrations) { options.DiagnosticLogger?.LogDebug("Registering integration: '{0}'.", integration.GetType().Name); integration.Register(this, options); } } // Push the first scope so the async local starts from here _rootScope = PushScope(); }
internal Hub(ISentryClient client, SentryOptions options) { _ownedClient = client; _options = options; if (Dsn.TryParse(options.Dsn) is null) { const string msg = "Attempt to instantiate a Hub without a DSN."; options.DiagnosticLogger?.LogFatal(msg); throw new InvalidOperationException(msg); } options.DiagnosticLogger?.LogDebug("Initializing Hub for Dsn: '{0}'.", options.Dsn); ScopeManager = new SentryScopeManager(options, _ownedClient); _integrations = options.Integrations; if (_integrations?.Length > 0) { foreach (var integration in _integrations) { options.DiagnosticLogger?.LogDebug("Registering integration: '{0}'.", integration.GetType().Name); integration.Register(this, options); } } // Push the first scope so the async local starts from here _rootScope = PushScope(); }