diff --git a/src/platforms/dotnet/guides/xamarin/finding-package-reference.png b/src/platforms/dotnet/guides/xamarin/finding-package-reference.png new file mode 100644 index 0000000000000..fd37140041c50 Binary files /dev/null and b/src/platforms/dotnet/guides/xamarin/finding-package-reference.png differ diff --git a/src/platforms/dotnet/guides/xamarin/system-memory-conflict.png b/src/platforms/dotnet/guides/xamarin/system-memory-conflict.png new file mode 100644 index 0000000000000..8364b42270399 Binary files /dev/null and b/src/platforms/dotnet/guides/xamarin/system-memory-conflict.png differ diff --git a/src/platforms/dotnet/guides/xamarin/troubleshooting.mdx b/src/platforms/dotnet/guides/xamarin/troubleshooting.mdx index 36de25f790472..616d1062d4b1a 100644 --- a/src/platforms/dotnet/guides/xamarin/troubleshooting.mdx +++ b/src/platforms/dotnet/guides/xamarin/troubleshooting.mdx @@ -14,27 +14,73 @@ 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` -If this message displays in your debug window when capturing an event or transaction, manually edit your platform `csproj`: - -1. Close your IDE. -2. Open your iOS `.csproj` with a text or xml editor. -3. Add the following NuGet reference: -```xml - - 4.5.4 - -``` - +OR -It's important to add the `IncludeAssets` as `None`, or this fix will not work. +`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: + +```csharp + _ = 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. +![System.Memory conflict](system-memory-conflict.png) + +To solve this, you will need to follow the steps below: + +1. Edit your iOS 'csproj' +* `Visual Studio (Mac)`: Right-click on your iOS project and at the bottom, select the option `Edit Project File`. +* `Visual Studio (Windows)`: Right-click on your iOS project, select the option `Unload Project`. By doing that action, it'll open your raw project solution, otherwise, right-click your iOS project and select the option `Edit project file`. + + +You can also use an external text editor or another IDE to edit your iOS project. -4. Save and open your IDE -5. Wait for the IDE to restore the packages. Once finished, try to capture an exception or transaction +2. Locate the `ItemGroup` that contains `PackageReference`. +![ItemGroup with packagereference](finding-package-reference.png) + +3. Add a new `packagereference` as shown on the snippet: -Another way to validate if the problem is happening on an iOS project is by adding the following code to your iOS project, to check if there's a conflict: ```csharp - _ = new byte[2].AsMemory(); + ``` + + +It's important to add the `IncludeAssets` as `None`, or this fix will not work. + + + +Using Reference will not work, it must be PackageReference. + + +4. Save the edited `csproj` file and reload your project if it was unloaded: +* `Visual Studio (Windows)`: Right-click on your iOS project, select the option `Reload Project`. +5. If the extension `AsMemory` keeps showing the conflict you will need to restart your IDE to make sure the changes are applied. +6. Wait for the IDE to restore the packages. Once finished, try to capture an exception or transaction. +7. If the extension `AsMemory` is still showing as conflicted, double-check if you executed step 3 exactly as shown. +8. 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 + +## tvOS + +You may encounter the following issue on a tvOS project: + +### Build issues + +`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) + +1. Open your iOS project properties. +2. On `tvOS Build` locate the `Additional mtouch arguments` entry. +3. add the following line + +`--dlsym:System.Reflection.Metadata.dll` + +4. Make sure the `additional mtouch argument` is applied to all configurations and platforms. +![iOS project mtouch arguments](tvos-metadata.jpg) diff --git a/src/platforms/dotnet/guides/xamarin/tvos-metadata.jpg b/src/platforms/dotnet/guides/xamarin/tvos-metadata.jpg new file mode 100644 index 0000000000000..e364af619b48f Binary files /dev/null and b/src/platforms/dotnet/guides/xamarin/tvos-metadata.jpg differ