Search code examples
c#vb.netsentryc#-to-vb.net

SentrySDK VB.NET initialization example


How do I convert the SentrySDK C# initialization code to VB.NET?

using (SentrySdk.Init(o =>
{
    o.Dsn = "https://examplePublicKey@o0.ingest.sentry.io/0";
    o.MaxBreadcrumbs = 50;
    o.Debug = true;
}))
{
}

Update

I get the following error using the code provided by Dave below.

enter image description here

Update 2:

The error happens with SentrySDK 2, but is resolved with SentrySDK 3.


Solution

  • The confusion is just in the placement of the lambda I think. The VB equivalent is just:

    Using SentrySdk.Init(Sub(o)
        o.Dsn = "https://examplePublicKey@o0.ingest.sentry.io/0"
        o.MaxBreadcrumbs = 50
        o.Debug = True
    End Sub)
    End Using