Troubleshooting
Learn more about how to troubleshoot common issues with the Xamarin SDK.
If you need help solving issues with Sentry's Xamarin SDK, you can read the edge cases documented here. If you need additional help, you can ask on GitHub. Customers on a paid plan may also contact support.
For users on Xamarin iOS, offline caching may cause this issue.
Failed to send cached envelope: System.MissingMethodException: Method not found: System.Text.Json.JsonDocument
OR
Attempting to JIT compile method 'System.Text.Json.JsonElement Sentry.Internal.Json:Parse (byte[])' while running in aot-only mode.
To help you debug the issue, add the following line to into your iOS project:
_ = new byte[2].AsMemory();
You will notice a conflict of Assemblies in regard to AsMemory extension, the same is happening with the Sentry SDK but only reveals the issue in runtime.
To solve this, you will need to follow the steps below:
- Edit your iOS 'csproj'
Visual Studio (Mac)
: Right-click on your iOS project and at the bottom, select the optionEdit Project File
.Visual Studio (Windows)
: Right-click on your iOS project, select the optionUnload Project
. By doing that action, it'll open your raw project solution, otherwise, right-click your iOS project and select the optionEdit project file
.
You can also use an external text editor or another IDE to edit your iOS project.
- Locate the
ItemGroup
that containsPackageReference
.
- Add a new
packagereference
as shown on the snippet:
<PackageReference Include="System.Memory" Version="4.5.4" IncludeAssets="None" />
It's important to add the IncludeAssets
as None
, or this fix will not work.
- Save the edited
csproj
file and reload your project if it was unloaded:
Visual Studio (Windows)
: Right-click on your iOS project, select the optionReload Project
.
- If the extension
AsMemory
keeps showing the conflict you will need to restart your IDE to make sure the changes are applied. - Wait for the IDE to restore the packages. Once finished, try to capture an exception or transaction.
- If the extension
AsMemory
is still showing as conflicted, double-check if you executed step 3 exactly as shown. - With the problem solved, you will no longer require the test code into your solution.
More information about this problem can be found here: https://github.com/mono/mono/issues/20805
You may encounter the following issue when sending Events or Envelopes:
The SSL connection could not be established, CERTIFICATE_VERIFY_FAILED
One solution is to alter your DSN; to do this, remove the values between @
and sentry.io
in your DSN.
- Before:
https://abc@1234.ingest.sentry.io/1234
- After:
https://abc@sentry.io/1234
Find more information here: https://github.com/xamarin/xamarin-android/issues/6351
You may encounter the following issue on a tvOS project:
linker command failed with exit code 1 (use -v to see invocation)
MTOUCH : error MT5216: Native linking failed for '.../libSystem.Reflection.Metadata.dll.dylib'. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new
If this message displays in your build window when building your tvOS solution, you will need an additional mtouch argument in the project's iOS Build options (for all device configurations)
- Open your iOS project properties.
- On
tvOS Build
locate theAdditional mtouch arguments
entry. - add the following line
--dlsym:System.Reflection.Metadata.dll
- Make sure the
additional mtouch argument
is applied to all configurations and platforms.
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").