コード例 #1
0
        public void Implicit_ToGuid()
        {
            var  expected = new SentryId(Guid.NewGuid());
            Guid actual   = expected;

            Assert.Equal(expected.ToString(), actual.ToString("N"));
        }
コード例 #2
0
        public void ToString_Equal_GuidToStringN()
        {
            var      expected = Guid.NewGuid();
            SentryId actual   = expected;

            Assert.Equal(expected.ToString("N"), actual.ToString());
        }
コード例 #3
0
        public static string SendException(Exception exception)
        {
#if !DEBUG
            string pluginDiretoryKey = nameof(Plugin.PluginPair.Metadata.PluginDirectory);
            if (exception.Data.Contains(pluginDiretoryKey))
            {
                string pluginDirectory = exception.Data[pluginDiretoryKey] as string;
                bool   debug           = pluginDirectory.Contains(@"\Output\Release") || pluginDirectory.Contains(@"\Output\Release");
                bool   thirdParty      = !pluginDirectory.Contains(Constant.ProgramDirectory);
                if (debug || thirdParty)
                {
                    return(SentryId.Empty.ToString());
                }
            }

            SentryId id = SentryId.Empty;
            SentrySdk.WithScope(scope =>
            {
                scope.Level = SentryLevel.Fatal;
                id          = SentrySdk.CaptureException(exception);
            });
            return(id.ToString());
#else
            return(SentryId.Empty.ToString());
#endif
        }