Troubleshooting

Learn more about how to troubleshoot common issues with the .NET SDK.

The following message may appear in your build output:

The Sentry CLI is not fully configured with authentication, organization, and project.

The message currently appears as information only, though we may change it to a warning in the future. This means that you are building in Release configuration, and you have not fully configured MSBuild for Sentry CLI. You can handle this in one of the following ways:

  • You can enable the Sentry CLI in your build by providing configuration details, as described in the documentation here.

  • You can prevent the message from being generated by setting the property <UseSentryCLI>false</UseSentryCLI> in your .NET project file, or with /p:UseSentryCLI=false on the command line to dotnet build or msbuild. Sentry CLI will be disabled.

  • You can do nothing, and just ignore the message. Sentry CLI will be disabled.

Keep in mind that if the Sentry CLI is disabled, then debug information files such as PDB symbols will not be sent to Sentry. If Sentry cannot locate symbols, then it cannot perform symbolication of stack traces. This means that for some types of projects (depending on configuration), you may not see filenames and line numbers to help you locate the source of an exception.

Support for Xcode 16.0 was added on version 4.12.0 of the Sentry SDK for .NET If you are using Xcode 16.0, you will need to update the SDK version 4.12.0 or later. If you are still using Xcode 15.4 or earlier, you need to continue to use version 4.11.0 or earlier.

Using Xcode 16 to build .NET applications targeting iOS and Mac Catalyst requires .NET workload for iOS SDK version 18.0.8303. We built the SDK version 4.12.0 using Xcode 16 in order to support this scenario. That, unfortunately, breaks folks using older version of Xcode.

As such, if you are using SDK version 4.12.x and targeting iOS or Mac Catalyst, you will need to install and use Xcode 16 and workload iOS SDK 18.0.8303

Note that .NET 9 will also support Xcode 16, when it is released next month (Nov 2024).

Sentry: (Error) Sentry rejected the envelope 5bfe4129cb2446c08768b16479865035. Status code: RequestEntityTooLarge. Error detail: failed to read request body. Error causes: A payload reached size limit..

You can have the Sentry .NET SDK write these envelopes to a path in order to troubleshoot why they are too large. Set the environment variable SENTRY_KEEP_LARGE_ENVELOPE_PATH to the directory you want these to be written to. Make sure the process the SDK is running in has write access to it.

If you're using a proxy server that relies on X-Forwarded-For, you might need to configure ASP.NET Core so that it's aware of it.

See this GitHub issue for more context.

Starting with C# 7.1, a program's Main method can be declared either synchronously or asynchronously. This is further enhanced in C# 9 by the use of top-level statements, which can also be declared synchronously or asynchronously.

While using either of these features with previous versions of the Sentry .NET SDK, when SentrySdk.Init is called within a using statement unhandled exceptions might not get captured. Additionally, if you were using an async main, associated transactions might not get marked as failed and sent to Sentry.

These issues have been fully resolved as of version 3.31.0 of the Sentry .NET SDK. To safely use an async main, update your version to the newest release. It's no longer required to dispose of the result of calling SentrySdk.Init.

Copied
The call is ambiguous between the following methods or properties:
Sentry.SentryOptionsExtensions.DisableDiagnosticSourceIntegration(Sentry.SentryOptions)
and Sentry.SentryOptionsDiagnosticExtensions.DisableDiagnosticSourceIntegration(Sentry.SentryOptions)

The above error means that the version of the Sentry package you are using already contains the DiagnosticSource integration within itself, but you additionally installed Sentry.DiagnosticSource, which is only relevant for older framework versions.

To resolve this problem, remove the package reference to Sentry.DiagnosticSource.

SentryOptions does not contain a definition for AddDiagnosticSourceIntegration.

The above error could have two meanings:

  • You're using an outdated SDK (3.8.3 or older).

  • Your project already includes the integration automatically. You can validate it by observing the debug information from Sentry SDK. Enable it through the options.

Your debug window will have following messages:

Copied
Debug: Logging enabled with ConsoleDiagnosticLogger and min level: Debug
Debug: Initializing Hub for Dsn: 'https://examplePublicKey@o0.ingest.sentry.io/0'.
Debug: Using 'GzipBufferedRequestBodyHandler' body compression strategy with level Optimal.
Debug: New scope pushed.
Debug: Registering integration: 'AutoSessionTrackingIntegration'.
Debug: Registering integration: 'AppDomainUnhandledExceptionIntegration'.
Debug: Registering integration: 'AppDomainProcessExitIntegration'.
Debug: Registering integration: 'TaskUnobservedTaskExceptionIntegration'.
Debug: Registering integration: 'SentryDiagnosticListenerIntegration'.

If the debug file contains information about SentryDiagnosticListenerIntegration, then your project already includes the integration automatically.

From version 3.14.0, Sentry will respect Implicit Usings. This means is Implicit Usings is enabled (<ImplicitUsings>enable</ImplicitUsings> or <ImplicitUsings>true</ImplicitUsings>) then Sentry will be added to the current global using directives. This means that using Sentry; can be omitted from any .cs files.

In some scenarios Implicit Usings can result in type name conflicts. For example Session may exist in multiple namespaces. This can be resolved by fully qualifying the type inline (Sentry.Session), or with a using alias:

Copied
using SentrySession = Sentry.Session;

Then SentrySession can be used instead of Sentry.Session.

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").