public void UwpSentryIntegration_Register_UnhandledException() { var integration = new UwpSentryIntegration(); var eventProcessorCalled = new ManualResetEvent(false); var eventProcessor = new MockEventProcessor(eventProcessorCalled); SentrySdk.Init(o => { o.Dsn = "https://[email protected]/5428537"; o.AddEventProcessor(eventProcessor); o.AddIntegration(integration); }); integration.Handle(new Exception("Boom")); Assert.IsTrue(eventProcessorCalled.WaitOne(1000)); }
public static void Main(string[] args) { //Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP"); var sentryOptions = new SentryOptions { BeforeSend = BeforeSend, Dsn = new Dsn("https://[email protected]/1795758"), }; using (SentrySdk.Init(sentryOptions)) { App.Main(); } }
/// <summary> /// Override this to add custom behavior to execute after the application starts. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The args.</param> protected override void OnStartup(object sender, System.Windows.StartupEventArgs e) { var settings = this._container.GetInstance <SettingsService>(); this._sentry = SentrySdk.Init(Dsn); SentrySdk.ConfigureScope((c) => { c.User = new Sentry.Protocol.User() { Id = settings.UserId, }; }); DisplayRootViewFor <ShellViewModel>(); }
public win_PasswordChange() { using (SentrySdk.Init(conn)) { try { InitializeComponent(); lbl_StatusMessage.Visibility = Visibility.Hidden; } catch (Exception ex) { SentrySdk.CaptureException(ex); } } }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { Setting setting = new Setting(); using (SentrySdk.Init(setting.sentryDSN)) { // App code ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new OWSOService(setting) }; ServiceBase.Run(ServicesToRun); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); SentryDatabaseLogging.UseBreadcrumbs(); _sentry = SentrySdk.Init(o => { o.Dsn = new Dsn(Properties.Settings.Default.SentryDSN); o.AddEntityFramework(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/error/503.html"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } //This remaps node_modules to lib for accesing by pages app.UseStaticFiles(new StaticFileOptions() { FileProvider = new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), @"node_modules")), RequestPath = new PathString("/vendor") }); //Route /Identity/Account to /Account var URLRewitingOptions = new RewriteOptions() .AddRedirect("Identity/Account/(.*)", "Account/$1") .AddRewrite(@"^Account/(.*)", "Identity/Account/$1", skipRemainingRules: true); app.UseRewriter(URLRewitingOptions); //app.UseStatusCodePages(); app.UseStatusCodePagesWithReExecute("/error/{0}.html"); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(); //Sentry error level tracing & release version bundlng config SentrySdk.ConfigureScope(scope => { scope.Level = SentryLevel.Warning; }); SentrySdk.Init(o => o.Release = "ftc-scouting-app-skystone@" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString().Substring(0, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString().LastIndexOf('.'))); }
static void Main() { if (IsMoreThanOneInstance()) { return; } //Console.WriteLine(System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.Create)); // TODO: Implement for error logging in released versions AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; #if SENTRY const string SENTRY_DSN = "https://e11516741a32440ca7a72b68d5af93df@sentry.do-ny3.svr.gw2blishhud.com/2"; using (SentrySdk.Init( o => { o.Dsn = new Dsn(SENTRY_DSN); o.Release = APP_VERSION; o.Environment = APP_VERSION.Contains("-") ? APP_VERSION.Split('-')[1].Split('.')[0] : APP_VERSION; o.Debug = true; o.BeforeSend = sentryEvent => { /* TODO: Confirm that this filters correctly - consider filtering more details and * move it all to it's own function */ sentryEvent.LogEntry.Message = sentryEvent.LogEntry.Message.Replace(Environment.UserName, "<SENTRY-FILTERED-OUT-USERNAME>"); sentryEvent.Message = sentryEvent.Message.Replace(Environment.UserName, "<SENTRY-FILTERED-OUT-USERNAME>"); return(sentryEvent); }; })) { SentrySdk.ConfigureScope( scope => { // Want to try and gauge what kind of language support we'll want to provide in the future scope.SetTag("locale", CultureInfo.CurrentCulture.DisplayName); // Try to avoid accidentally pulling their user account name (since it could have their real name in it) scope.SetTag("start-dir", Directory.GetCurrentDirectory().Replace(Environment.UserName, "<SENTRY-FILTERED-OUT-USERNAME>")); }); using (var game = new Overlay()) game.Run(); } #else using (var game = new Overlay()) game.Run(); #endif SingleInstanceMutex.ReleaseMutex(); }
public static int Main() { AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; using (SentrySdk.Init(o => { if (!File.Exists("BILILIVE_RECORDER_DISABLE_SENTRY") && string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("BILILIVE_RECORDER_DISABLE_SENTRY"))) { o.Dsn = new Dsn("https://[email protected]/5556540"); } var v = typeof(Program).Assembly.GetName().Version; if (v.Major != 0) { o.Release = "BililiveRecorder@" + v.ToString(); } o.DisableAppDomainUnhandledExceptionCapture(); o.AddExceptionFilterForType <System.Net.Http.HttpRequestException>(); })) { SentrySdk.ConfigureScope(s => { try { var path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), "..", "packages", ".betaId")); if (!File.Exists(path)) { return; } var content = File.ReadAllText(path); if (Guid.TryParse(content, out var id)) { s.User = new Sentry.Protocol.User { Id = id.ToString() } } ; } catch (Exception) { } }); var app = new App(); app.InitializeComponent(); app.DispatcherUnhandledException += App_DispatcherUnhandledException; return(app.Run()); } }
public static void Init(SentryUnityOptions options) { SentryOptionsUtility.TryAttachLogger(options); if (options.ShouldInitializeSdk()) { // On Standalone, we disable cache dir in case multiple app instances run over the same path. // Note: we cannot use a named Mutex, because Unit doesn't support it. Instead, we create a file with `FileShare.None`. // https://forum.unity.com/threads/unsupported-internal-call-for-il2cpp-mutex-createmutex_internal-named-mutexes-are-not-supported.387334/ if (ApplicationAdapter.Instance.Platform is RuntimePlatform.WindowsPlayer && options.CacheDirectoryPath is not null) { try { _lockFile = new FileStream(Path.Combine(options.CacheDirectoryPath, "sentry-unity.lock"), FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); } catch (Exception ex) { options.DiagnosticLogger?.LogWarning("An exception was thrown while trying to " + "acquire a lockfile on the config directory: .NET event cache will be disabled.", ex); options.CacheDirectoryPath = null; options.AutoSessionTracking = false; } } var sentryDotNet = SentrySdk.Init(options); ApplicationAdapter.Instance.Quitting += () => { options.DiagnosticLogger?.LogDebug("Closing the sentry-dotnet SDK"); try { sentryDotNet.Dispose(); } finally { try { // We don't really need to close, Windows would release the lock anyway, but let's be nice. _lockFile?.Close(); } catch (Exception ex) { options.DiagnosticLogger?.Log(SentryLevel.Warning, "Exception while releasing the lockfile on the config directory.", ex); } } }; } }
static void Main() { ConfigReader.Load(Assembly.GetAssembly(typeof(Config))); if (Config.SentryEnabled && !string.IsNullOrEmpty(Config.SentryDSN)) { using (SentrySdk.Init(Config.SentryDSN)) Init(); } else { Init(); } ConfigReader.Save(typeof(Config).Assembly); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); SentryDatabaseLogging.UseBreadcrumbs(); _sentrySdk = SentrySdk.Init(o => { // We store the DSN inside Web.config o.Dsn = new Dsn(ConfigurationManager.AppSettings["SentryDsn"]); // Add the EntityFramework integration o.AddEntityFramework(); }); }
public MainWindow() { conn = ConfigurationManager.ConnectionStrings["DSN"].ConnectionString; if (!string.IsNullOrEmpty(conn)) { SentrySdk.Init(conn); } else { MessageBox.Show("Sentry Key not Found", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } InitializeComponent(); readXML(); BindComboBoxWithAvailablePorts(); InitializeAllPortsToSerialPorts(true); }
public virtual void CreateRange(IEnumerable <TEntity> entities) { try { _dbSet.AddRange(entities); } catch (Exception ex) { using (SentrySdk.Init("https://[email protected]/1505243")) { SentrySdk.CaptureException(ex); } throw; } }
public Login() { conn = ConfigurationManager.ConnectionStrings["DSN"].ConnectionString; if (!string.IsNullOrEmpty(conn)) { SentrySdk.Init(conn); } else { MessageBox.Show("Sentry Key not Found", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } InitializeComponent(); CreatingLoginCredentialFile(); CreatingLogFile(); }
public virtual void Remove(TKey id) { try { _dbSet.Remove(_dbSet.Find(id)); } catch (Exception ex) { using (SentrySdk.Init("https://[email protected]/1505243")) { SentrySdk.CaptureException(ex); } throw; } }
public App() { DispatcherUnhandledException += App_DispatcherUnhandledException; SentrySdk.Init(o => { // NOTE: Change the URL below to your own DSN. Get it on sentry.io in the project settings (or when you create a new project): o.Dsn = "https://[email protected]/5428537"; // Enable offline caching o.CacheDirectoryPath = Path.Combine( Directory.GetCurrentDirectory(), "SentryCache" ); }); }
public override void _Ready() { SentrySdk.Init(o => { o.Dsn = new Dsn("https://[email protected]/5170198"); }); SentrySdk.ConfigureScope(s => { s.SetTag("os.name", OS.GetName()); s.SetTag("os.model", OS.GetModelName()); }); SentrySdk.AddBreadcrumb( message: "Sentry initialized", category: "init", level: BreadcrumbLevel.Info); }
public override void OnException(ExceptionContext context) { using (SentrySdk.Init(sentryDSN)) { var internalIP = Dns.GetHostEntry(Dns.GetHostName()).AddressList?.Where(c => c.AddressFamily == AddressFamily.InterNetwork).ToString(); SentrySdk.AddBreadcrumb($"{Environment.MachineName ?? string.Empty} - {internalIP ?? string.Empty }", "Machine Identification"); SentrySdk.CaptureException(context.Exception); } context.Result = context.Exception is NegocioException ? new ResultadoBaseResult(context.Exception.Message, ((NegocioException)context.Exception).StatusCode) : new ResultadoBaseResult("Ocorreu um erro interno. Favor contatar o suporte.", 500); base.OnException(context); }
protected override void OnStartup(StartupEventArgs e) { SplashScreen splashScreen = new SplashScreen("logo-bar-rupali-edit.jpg"); splashScreen.Show(true); string dsnKey = ConfigurationManager.ConnectionStrings["DSN"].ConnectionString; if (!string.IsNullOrEmpty(dsnKey)) { SentrySdk.Init(dsnKey); } else { MessageBox.Show("Sentry Key not Found", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } }
/// <summary> /// Window constructor<para/> /// Конструктор окна /// </summary> /// <param name="width">Window width<para/>Ширина окна</param> /// <param name="height">Window height<para/>Высота окна</param> /// <param name="fullscreen">Use fullscreen window<para/>Использовать полноэкранное окно</param> public GameForm(int width, int height, bool fullscreen) : base(width, height, new GraphicsMode(new ColorFormat(24), 24), "OpenVice", GameWindowFlags.Default, DisplayDevice.Default, 2, 4, GraphicsContextFlags.Default) { using (SentrySdk.Init("https://[email protected]/5426812")) { Load += InitEventHook; UpdateFrame += UpdateEventHook; RenderFrame += RenderEventHook; Resize += ResizeEventHook; Icon = OpenVice.Properties.Resources.AppIcon; Viewport.Size = new Vector2(ClientSize.Width, ClientSize.Height); Camera.Zoom = 1f; Camera.FarClip = 2000f; } }
public virtual void Create(TEntity entity) { try { _dbSet.Add(entity); } catch (Exception ex) { using (SentrySdk.Init(ConfigurationManagerHelper.SentryUrl)) { SentrySdk.CaptureException(ex); } throw; } }
public SentryLogService( string enviroment = "development", string release = "1-0-0", string key = "https://[email protected]/5389957" ) { Dsn dsn = new Dsn(key); Action <SentryOptions> options = new Action <SentryOptions>(x => { x.Dsn = dsn; x.Environment = enviroment; x.Release = release; }); SentrySdk.Init(options); }
public Engine(string indexLocation) { SentrySdk.Init("https://[email protected]/4202655"); SentrySdk.ConfigureScope(scope => { scope.User = new User { Id = MachineCode.MachineCode.GetMachineCode() }; }); _directory = FSDirectory.Open(indexLocation); var indexConfig = new IndexWriterConfig(AppLuceneVersion, _analyzer); _writer = new IndexWriter(_directory, indexConfig); }
private void ConfigureSentry() { sentry = SentrySdk.Init(o => { o.Dsn = new Dsn(Dsn); }); SentrySdk.ConfigureScope(scope => { scope.User = new User() { Id = "MyUniqueUserId" }; scope.SetTag("myTagKey", "myTagValue"); }); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); SentryDatabaseLogging.UseBreadcrumbs(); _sentry = SentrySdk.Init(o => { // We store the DSN inside Web.config; make sure to use your own DSN! o.Dsn = new Dsn(ConfigurationManager.AppSettings["SentryDsn"]); // Get Entity Framework integration o.AddEntityFramework(); }); }
private static async Task Main(string[] args) { using (SentrySdk.Init("https://[email protected]/216217")) { IClusterClient client = new ClientBuilder() .UseEnvironment(EnvironmentName.Development) .UseDynamoDBClustering((Action <DynamoDBGatewayOptions>)null) .Configure <NetworkingOptions>( options => options.OpenConnectionTimeout = TimeSpan.FromSeconds(10)) .ConfigureAppConfiguration( (context, configure) => configure .AddJsonFile( "appsettings.json", false) .AddJsonFile( $"appsettings.{context.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args)) .ConfigureServices(Configure) .Build(); try { await client.Connect(); var gate = new Gate(client); await gate.Run(); var closeEvent = new AutoResetEvent(false); Console.CancelKeyPress += (sender, e) => { closeEvent.Reset(); }; closeEvent.WaitOne(); client.ServiceProvider.GetService <ILogger <Gate> >().LogInformation("stopping"); gate.Server.Stop(); await client.Close(); } catch (SiloUnavailableException) { client.ServiceProvider.GetService <ILogger <Gate> >().LogCritical("Silo connecting fails"); } catch (OrleansConfigurationException configurationException) { client.ServiceProvider.GetService <ILogger <Gate> >() .LogCritical(configurationException, "Configuration missing"); } } }
private async Task HandleMessage(string content) { using (SentrySdk.Init(configuration.GetSection("Sentry:DSN").Value)) { var request = JsonConvert.DeserializeObject <FiltroRelatorioDto>(content); try { _logger.LogInformation($"[ INFO ] Messaged received: {content}"); if (!content.Equals("null")) { MethodInfo[] methods = typeof(WorkerSGPController).GetMethods(); foreach (MethodInfo method in methods) { ActionAttribute actionAttribute = GetActionAttribute(method); if (actionAttribute != null && actionAttribute.Name == request.Action) { _logger.LogInformation($"[ INFO ] Invoking action: {request.Action}"); var serviceProvider = _scopeFactory.CreateScope().ServiceProvider; var controller = serviceProvider.GetRequiredService <WorkerSGPController>(); var useCase = serviceProvider.GetRequiredService(actionAttribute.TipoCasoDeUso); await method.InvokeAsync(controller, new object[] { request, useCase }); _logger.LogInformation($"[ INFO ] Action terminated: {request.Action}"); return; } } _logger.LogInformation($"[ INFO ] Method not found to action: {request.Action}"); } } catch (NegocioException ex) { NotificarUsuarioRelatorioComErro(request, ex.Message); SentrySdk.CaptureException(ex); } catch (Exception ex) { NotificarUsuarioRelatorioComErro(request, "Erro não identificado, por favor tente novamente."); SentrySdk.CaptureException(ex); } } }
public static void Main(string[] args) { var environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); if (string.IsNullOrEmpty(environment)) { throw new Exception("ASPNETCORE_ENVIRONMENT environment variable should be set"); } var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddEnvironmentVariables() .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{environment}.json") .AddJsonFile($"appsettings.local.json", true) .AddCommandLine(args) .Build(); using (SentrySdk.Init(configuration["Sentry:DSN"])) { var logger = new LoggerConfiguration() .ReadFrom.Configuration(configuration) .WriteTo.Sentry() .WriteTo.Console(theme: AnsiConsoleTheme.Code) .CreateLogger(); var server = new WebHostBuilder() .ConfigureKestrel((context, options) => { options.Limits.MaxRequestBodySize = 60000000; if (!string.IsNullOrEmpty(context.Configuration["socket"])) { options.ListenUnixSocket(context.Configuration["socket"]); } }) .UseKestrel() .UseSentry(o => o.BeforeSend = DefaultSentryEventExceptionProcessor.BeforeSend) .UseContentRoot(Directory.GetCurrentDirectory()) .UseEnvironment(environment) .UseStartup <Startup>() .UseSerilog(logger) .UseConfiguration(configuration) .Build(); server.Run(); } }
public static void Init(Config config, ILogger logger = null) { var options = new SentryOptions { Release = $"vpn.windows-{config.AppVersion}", AttachStacktrace = true, Dsn = !string.IsNullOrEmpty(GlobalConfig.SentryDsn) ? new Dsn(GlobalConfig.SentryDsn) : null, }; if (logger != null) { options.Debug = true; options.DiagnosticLogger = new SentryDiagnosticLogger(logger); } SentrySdk.Init(options); }