static async Task ProposedApi() { SentrySdk.Init(); SentrySdk.ConfigureScope(s => s.AddTag("Some proposed APIs")); // if the goal is avoiding execution of the callback when the SDK is disabled // the simplest API is a delegate to create the event // Async is best if underlying client is doing I/O (writing event to disk or sending via HTTP) var id = await SentrySdk.CaptureEventAsync(async() => { // NOT invoked if the SDK is disabled var dbStuff = await DatabaseQuery(); return(new SentryEvent(dbStuff)); }); Console.WriteLine("Id: " + id); // Blocking alternative (best if using in-memory queue) id = SentrySdk.CaptureEvent(() => new SentryEvent("Nothing async in this callback")); Console.WriteLine("Id: " + id); }