The Data Source Name of a given project in Sentry.
Beispiel #1
0
        /// <summary>
        /// Initializes the <see cref="RavenClient"/> class which you can then access through <see cref="Instance"/>. 
        /// Call this in your App() constructor before InitializeComponent()
        /// </summary>
        /// <param name="dsn"></param>
        /// <param name="captureUnhandled"></param>
        public static void InitializeAsync(Dsn dsn, bool captureUnhandled = true)
        {
            if (_instance != null)
                return;

            _instance = new RavenClient(dsn, captureUnhandled);

            _instance.FlushStoredPayloadsAsync().ContinueWith(t => _instance.HandleInternalException(t.Exception), TaskContinuationOptions.OnlyOnFaulted);
        }
Beispiel #2
0
        public static IDisposable Init(SentryOptions options)
        {
            if (options.Dsn == null)
            {
                if (!Dsn.TryParse(DsnLocator.FindDsnStringOrDisable(), out var dsn))
                {
                    // TODO: Log that it continues disabled
                    return(DisabledHub.Instance);
                }
                options.Dsn = dsn;
            }

            var hub = new Hub(options);

            _hub = hub;
            return(new DisposeHandle(hub));
        }
Beispiel #3
0
        protected RavenClient(Dsn dsn, bool captureUnhandled = true)
        {
            Dsn = dsn;

#if NETFX_CORE
            _storage  = new RavenStorageClient();
            _platform = new WindowsPlatformClient();
#endif

            _httpClient = BuildHttpClient();

            if (captureUnhandled)
            {
#if NETFX_CORE
                Application.Current.UnhandledException += Application_UnhandledException;
#endif
            }
        }
Beispiel #4
0
        protected RavenClient(Dsn dsn, bool captureUnhandled = true)
        {
            Dsn = dsn;

#if NETFX_CORE
            _storage = new RavenStorageClient();
            _platform = new WindowsPlatformClient();
#endif

            _httpClient = BuildHttpClient();

            if (captureUnhandled)
            {
#if NETFX_CORE
                Application.Current.UnhandledException += Application_UnhandledException;
#endif
            }
        }
        /// <summary>
        /// Tries to parse the string into a <see cref="Dsn"/>.
        /// </summary>
        /// <param name="dsn">The string to attempt parsing.</param>
        /// <param name="finalDsn">The <see cref="Dsn"/> when successfully parsed.</param>
        /// <returns><c>true</c> if the string is a valid <see cref="Dsn"/> as was successfully parsed. Otherwise, <c>false</c>.</returns>
        public static bool TryParse(string dsn, [NotNullWhen(true)] out Dsn?finalDsn)
        {
            try
            {
                var parsed = Parse(dsn, false);
                if (parsed == null)
                {
                    finalDsn = null;
                    return(false);
                }

                finalDsn = new Dsn(parsed.Item1, parsed.Item2, parsed.Item3, parsed.Item4, parsed.Item5, parsed.Item6);
                return(true);
            }
            catch
            {
                // Parse should not throw though!
                finalDsn = null;
                return(false);
            }
        }
Beispiel #6
0
        public static IDisposable Init(SentryOptions options)
        {
            if (options.Dsn == null)
            {
                if (!Dsn.TryParse(DsnLocator.FindDsnStringOrDisable(), out var dsn))
                {
                    // TODO: Log that it continues disabled
                    return(DisabledHub.Instance);
                }
                options.Dsn = dsn;
            }

            var hub = new Hub(options);

            // Push the first scope so the async local starts from here
            hub.PushScope();

            var oldHub = Interlocked.Exchange(ref _hub, hub);

            (oldHub as IDisposable)?.Dispose();

            return(new DisposeHandle(hub));
        }
Beispiel #7
0
 /// <summary>
 /// Initializes the SDK with the specified DSN
 /// </summary>
 /// <param name="dsn">The dsn</param>
 public static IDisposable Init(Dsn dsn) => Init(c => c.Dsn = dsn);
Beispiel #8
0
 /// <summary>
 /// Initializes the SDK with the specified DSN
 /// </summary>
 /// <param name="dsn">The dsn</param>
 public static void Init(Dsn dsn) => Init(c => c.Dsn = dsn);