Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions docs/platforms/dotnet/common/migration/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,6 @@ Changed how to initialize Sentry:


```csharp
using Sentry;

// Initialize with DSN
SentrySdk.Init("___PUBLIC_DSN___");

Expand All @@ -414,7 +412,6 @@ For ASP.NET (classic) integration, add `Sentry.AspNet` package and initialize it


```csharp
using Sentry;
using Sentry.AspNet;

SentrySdk.Init(o =>
Expand Down
2 changes: 0 additions & 2 deletions docs/platforms/dotnet/common/tracing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ First, enable tracing and configure the sample rate for transactions. Set the sa
The two options are meant to be mutually exclusive. If you set both, <PlatformIdentifier name="traces-sampler" /> will take precedence.

```csharp {diff}
using Sentry;

+ // Add this to the SDK initialization callback
+ // Example uniform sample rate: capture 100% of transactions
+ options.TracesSampleRate = 1.0;
Expand Down
2 changes: 0 additions & 2 deletions docs/platforms/dotnet/common/user-feedback/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ User Feedback for **[ASP.NET](/platforms/dotnet/guides/aspnet/user-feedback/#int
You can create a form to collect the user input in your preferred framework, and use the SDK's API to send the information to Sentry. You can also use the widget, as described below. If you'd prefer an alternative to the widget or do not have a JavaScript frontend, you can use this API:

```csharp {tabTitle:C#}
using Sentry;

var eventId = SentrySdk.CaptureMessage("An event that will receive user feedback.");

SentrySdk.CaptureUserFeedback(eventId, "[email protected]", "It broke.", "The User");
Expand Down
1 change: 0 additions & 1 deletion docs/platforms/dotnet/guides/aspnet/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ You configure the SDK in the `Global.asax.cs`:
```csharp {"onboardingOptions": {"performance": "21-24, 34-43"}}
using System;
using System.Web;
using Sentry;
using Sentry.AspNet;
using Sentry.EntityFramework; // If you also installed Sentry.EntityFramework
using Sentry.Extensibility;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ using System;
using System.Configuration;
using System.Web.Mvc;
using System.Web.Routing;
using Sentry;
using Sentry.AspNet;

namespace AspNetMvc
Expand Down Expand Up @@ -87,7 +86,6 @@ Transactions created by this integration are automatically added to the current
```csharp
using System;
using System.Web.Mvc;
using Sentry;

public class HomeController : Controller
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Transactions created by this integration are automatically added to the current
```csharp
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Sentry;

public class HomeController : Controller
{
Expand Down
1 change: 0 additions & 1 deletion docs/platforms/dotnet/guides/entityframework/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ For example, configuring an ASP.NET app with _global.asax_:
```csharp {filename:global.asax} {"onboardingOptions": {"performance": "16-18, 27-36"}}
using System;
using System.Configuration;
using Sentry;
using Sentry.AspNet;

public class MvcApplication : System.Web.HttpApplication
Expand Down
1 change: 0 additions & 1 deletion docs/platforms/dotnet/guides/uwp/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ The SDK should be initialized in the constructor of your application class (usua


```csharp {"onboardingOptions": {"performance": "18-21"}}
using Sentry;
using Sentry.Protocol;
using UnhandledExceptionEventArgs = Windows.UI.Xaml.UnhandledExceptionEventArgs;

Expand Down
1 change: 0 additions & 1 deletion docs/platforms/dotnet/guides/winforms/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ A complete example of the recommended startup is as follows:
```csharp {"onboardingOptions": {"performance": "32-35"}}
using System;
using System.Windows.Forms;
using Sentry;

namespace WindowsFormsApp1
{
Expand Down
2 changes: 0 additions & 2 deletions docs/platforms/dotnet/guides/winui/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Select which Sentry features you'd like to install in addition to Error Monitori
<OnboardingOptionButtons options={['error-monitoring', 'performance']}/>

```csharp {"onboardingOptions": {"performance": "17-20"}}
using Sentry;
using Sentry.Protocol;

sealed partial class App : Application
Expand Down Expand Up @@ -82,7 +81,6 @@ Do not initialize the SDK in the `OnLaunched` event of the application or the `H

```csharp
// Add these to your existing using statements.
using Sentry;
using Sentry.Protocol;
using UnhandledExceptionEventArgs = Microsoft.UI.Xaml.UnhandledExceptionEventArgs;

Expand Down
2 changes: 0 additions & 2 deletions docs/platforms/unity/user-feedback/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ User Feedback for **[ASP.NET](/platforms/dotnet/guides/aspnet/user-feedback/#int
You can create a form to collect the user input in your preferred framework, and use the SDK's API to send the information to Sentry. You can also use the widget, as described below. If you'd prefer an alternative to the widget or do not have a JavaScript frontend, you can use this API:

```csharp {tabTitle:C#}
using Sentry;

var eventId = SentrySdk.CaptureMessage("An event that will receive user feedback.");

SentrySdk.CaptureUserFeedback(eventId, "[email protected]", "It broke.", "The User");
Expand Down
2 changes: 0 additions & 2 deletions platform-includes/capture-error/dotnet.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
In C# you can capture any exception object that you caught:

```csharp
using Sentry;

try
{
AFunctionThatMightFail();
Expand Down
4 changes: 0 additions & 4 deletions platform-includes/capture-message/dotnet.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
```csharp
using Sentry;

SentrySdk.CaptureMessage("Something went wrong");
```

```fsharp
open Sentry

SentrySdk.CaptureMessage("Something went wrong")
```
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
A `Func<SentryTransaction, Hint, SentryTransaction?>` can be used to update the transaction or drop it by returning `null` before it gets sent to Sentry. For example:

```csharp
using Sentry;

// Add this to the SDK initialization callback
options.SetBeforeSendTransaction((sentryTransaction, hint) =>
{
Expand All @@ -14,4 +12,4 @@ options.SetBeforeSendTransaction((sentryTransaction, hint) =>

return sentryTransaction;
});
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Start-Sentry {
# Add this to the SDK initialization callback
$_.SetBeforeSendTransaction([System.Func[Sentry.SentryTransaction, Sentry.SentryTransaction]] {
param([Sentry.SentryTransaction]$sentryTransaction)

# Modify the transaction
if ($sentryTransaction.Operation -eq 'http.server')
{
Expand All @@ -20,9 +20,6 @@ Start-Sentry {
```

```csharp
using Sentry;


options.SetBeforeSendTransaction((sentryTransaction, hint) =>
{
});
Expand Down
2 changes: 0 additions & 2 deletions platform-includes/configuration/before-send/dotnet.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
A `Func<SentryEvent, Hint, SentryEvent?>` can be used to mutate, discard (return null), or return a completely new event.

```csharp
using Sentry;

// Add this to the SDK initialization callback
options.SetBeforeSend((sentryEvent, hint) =>
{
Expand Down
2 changes: 0 additions & 2 deletions platform-includes/configuration/config-intro/dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ For example, initialize with `SentrySdk.Init` in your `Program.cs` file:


```csharp
using Sentry;

SentrySdk.Init(options =>
{
// A Sentry Data Source Name (DSN) is required.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ pass the option object along for modifications:


```csharp
using Sentry;

SentryXamarin.Init(o =>
{
o.Dsn = "___PUBLIC_DSN___";
Expand Down
4 changes: 0 additions & 4 deletions platform-includes/configuration/sample-rate/dotnet.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
```csharp
using Sentry;

// Add this to the SDK initialization callback
options.SampleRate = 0.25;
```

```fsharp
open Sentry

// Add this to the SDK initialization callback
options.SampleRate <- 0.25 // Capture 25%
```
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Here's an example using RabbitMQ of how to extract and store incoming tracing in
using System.Text;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
using Sentry;

var factory = new ConnectionFactory()
{
Expand Down Expand Up @@ -62,7 +61,6 @@ If you're not using the `SentryHttpMessageHandler`, you can generate this tracin

```csharp
using RabbitMQ.Client;
using Sentry;

var factory = new ConnectionFactory()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

SentrySdk.ConfigureScope(scope =>
{
// Add an in-memory attachment to the current scope
Expand All @@ -9,8 +7,6 @@ SentrySdk.ConfigureScope(scope =>
```

```fsharp
open Sentry

SentrySdk.ConfigureScope(
fun scope ->
// Add an in-memory attachment to the current scope
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

SentrySdk.ConfigureScope(scope =>
{
// Add a file attachment to the current scope
Expand All @@ -9,8 +7,6 @@ SentrySdk.ConfigureScope(scope =>
```

```fsharp
open Sentry

SentrySdk.ConfigureScope(
fun scope ->
// Add a file attachment to the current scope
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

SentrySdk.ConfigureScope(scope =>
{
scope.AddAttachment(Path.Combine(Application.persistentDataPath, "file.log"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

// Add this to the SDK initialization callback
options.MaxAttachmentSize = 5 * 1024 * 1024; // 5 MiB
```
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

// Global Scope
SentrySdk.ConfigureScope(scope =>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

SentrySdk.ConfigureScope(scope =>
{
scope.AddAttachment(Path.Combine(Application.persistentDataPath, "file.log"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

// Add this to the SDK initialization callback
options.SetBeforeBreadcrumb(breadcrumb
// Ignore breadcrumbs from Spammy logger
Expand All @@ -10,8 +8,6 @@ options.SetBeforeBreadcrumb(breadcrumb
```

```fsharp
open Sentry

// Add this to the SDK initialization callback
options.SetBeforeBreadcrumb(fun breadcrumb ->
// Ignore breadcrumbs from Spammy logger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
```csharp
using Sentry;

SentrySdk.AddBreadcrumb(
message: "Authenticated user " + user.Email,
category: "auth",
level: BreadcrumbLevel.Info);
```

```fsharp
open Sentry

SentrySdk.AddBreadcrumb(
"Authenticated user " + user.Email,
"auth",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
You can create your own event processors by implementing the `ISentryEventProcessor` interface. You can also create custom processors for transactions by implementing the `ISentryTransactionProcessor`.

```csharp
using Sentry;
using Sentry.Extensibility;

public class CustomEventProcessor : ISentryEventProcessor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

SentrySdk.ConfigureScope(scope =>
{
scope.SetTag("my-tag", "my value");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

// will be tagged with my-tag="my value"
SentrySdk.CaptureException(new Exception("my error"), scope =>
{
Expand Down
4 changes: 0 additions & 4 deletions platform-includes/enriching-events/set-context/dotnet.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

SentrySdk.ConfigureScope(scope =>
{
scope.Contexts["character"] = new
Expand All @@ -13,8 +11,6 @@ SentrySdk.ConfigureScope(scope =>
```

```fsharp
open Sentry

SentrySdk.ConfigureScope(fun scope ->
scope.Contexts["character"] <- {|
Name = "Mighty Fighter"
Expand Down
2 changes: 0 additions & 2 deletions platform-includes/enriching-events/set-context/unity.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
```csharp
using Sentry;

class PlayerCharacter
{
public string Name { get; set; }
Expand Down
4 changes: 0 additions & 4 deletions platform-includes/enriching-events/set-tag/dotnet.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
```csharp
using Sentry;

SentrySdk.ConfigureScope(scope =>
{
scope.SetTag("page.locale", "de-at");
});
```

```fsharp
open Sentry

SentrySdk.ConfigureScope(fun scope ->
scope.SetTag("page.locale", "de-at")
)
Expand Down
4 changes: 0 additions & 4 deletions platform-includes/enriching-events/set-tag/dotnet.nlog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ For more information on how to dynamically set event tags via `NLog.config`, see
```

```csharp
using Sentry;

SentrySdk.ConfigureScope(scope =>
{
// You can still use NLog layouts in code to set configured propertes
Expand All @@ -37,8 +35,6 @@ SentrySdk.ConfigureScope(scope =>
```

```fsharp
open Sentry

SentrySdk.ConfigureScope(
fun scope ->
// You can still use NLog layouts in code to set configured propertes
Expand Down
Loading
Loading