Integrating with Windows Forms based Applications
To use inside a Windows Forms Application, do the following inside your main method:
[STAThread]
static void Main()
{
RollbarLocator.RollbarInstance.Configure(new RollbarConfig
{
AccessToken = "POST_SERVER_ITEM_ACCESS_TOKEN",
Environment = "production"
});
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += (sender, args) =>
{
RollbarLocator.RollbarInstance.Error(args.Exception);
};
AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
{
RollbarLocator.RollbarInstance.Error(
args.ExceptionObject as System.Exception
);
};
TaskScheduler.UnobservedTaskException += (sender, args) =>
{
RollbarLocator.RollbarInstance.Error(args.Exception);
};
Application.Run(new Form1());
}
Updated about 1 year ago