Giter Club home page Giter Club logo

Comments (18)

lucas-zimerman avatar lucas-zimerman commented on May 29, 2024 4

Hi @huyvuskedulo .

After further investigation, I was able to conclude tha this is a mono issue related to mono/mono#20805 and not with the SDK

You can also validate it by adding the following code anywhere into your iOS project:
var x = new byte[2].AsMemory();
You'll notice that you'll get the following error message
image
that happens because mono implements the extension AsMemory and other nuget (like the SqlLite one) also uses the System.Memory, causing the conflict.

Workaround

To solve this, you'll need to unload your iOS project,
image
Edit or replace the System.Memory reference by:

    <PackageReference Include="System.Memory" IncludeAssets="None">
      <Version>4.5.4</Version>
    </PackageReference>

Note: the parameter IncludeAssets="None" is required otherwise it'll not work.
image

After that, you'll need to reload your project AND Exit your solution (this is silly but Visual Studio will only apply the changes after you restart it)
image

Finally, after a while (took me a minute after the IDE sorted the packages references), you'll notice that the conflict will be sorted out and Sentry will stop throwing the mentioned error in this PR.
image

from sentry-xamarin.

huyvuskedulo avatar huyvuskedulo commented on May 29, 2024 1

Turn out, this is a bug from Akavache, i've linked the issue from Akavache to this one. I think Akavache is using the old System.Text.Json somehow.

from sentry-xamarin.

huyvuskedulo avatar huyvuskedulo commented on May 29, 2024 1

Thanks @lucas-zimerman , the workaround works for me

from sentry-xamarin.

bruno-garcia avatar bruno-garcia commented on May 29, 2024

Sounds like you have a consistent repro if you can just Init and send an event.

Would it be possible to strip stuff off of your app (or somehow make it into a repro you can share with us?).
That would really help us debug this.

from sentry-xamarin.

huyvuskedulo avatar huyvuskedulo commented on May 29, 2024

I will try to make a repo to share with you guys.

The problem is our current app is having a lot of dependencies, so i will try to make a new project to see if we can reproduce it.

from sentry-xamarin.

huyvuskedulo avatar huyvuskedulo commented on May 29, 2024

@bruno-garcia

Good news is i can reproduce this by cloning my project dependency into a more simple project.

Here is the link for the project.

https://github.com/unamed000/my-cat-demo/tree/sentry-error

(I cloned the dependency for the main PCL project and iOS, so you might need to test it on ios)

When you click on a cat in the list view, an error will be printed out like the one i reported

from sentry-xamarin.

huyvuskedulo avatar huyvuskedulo commented on May 29, 2024

ericsink/SQLitePCL.raw#422

After further investigation, we can see this package is conflicting with SQLitePCL.raw package, not Akavache (Akvache is using a dependency to this package).

We still don't know why when using SQLitePCL.raw, the wrong System.Text.JSON is used in Sentry package? So any ideas or suggestions to fix this will be really helpful for us to make sentry works in our app. (Because in Xamarin, a lot of people are using sqlite packages) @bruno-garcia

from sentry-xamarin.

merckxite avatar merckxite commented on May 29, 2024

We're experiencing exactly the same issue. Seems to have started happening when we migrated our apps onto the iOS14 API's (and in turn newer versions of Visual Studio for Mac, .Net SDK, Mono and Xamarin.iOS). We have none of the dependencies cited above as possible conflicts. Our Xamarin.Android project is fine.

Seems like this issue with System.Text.Json is happening elsewhere also https://docs.microsoft.com/en-us/answers/questions/302548/jsonserializer-throws-exception-in-xamarinios.html

We can consistently repro this in the latest version of VS for Mac:

Visual Studio 2019 for Mac: 8.10.1
Mono Framework MDK: 6.12.0.140
.NET Core SDK: 5.0.301
Xcode: 12.5
Xamarin.iOS: 14.20.0.3

Would also love to know if anyone has a workaround as this is affecting our ability to monitor errors in production.

from sentry-xamarin.

bruno-garcia avatar bruno-garcia commented on May 29, 2024

As @lucas-zimerman identified, this issue is discussed on the mono repository: mono/mono#20805

The work around is to add these dependencies directly to the app:

    <PackageReference Include="System.Memory" Version="4.5.4" />
    <PackageReference Include="System.Buffers" Version="4.5.1" />

We'll add this to the docs and possibly to the Xamarin SDK directly.

from sentry-xamarin.

huyvuskedulo avatar huyvuskedulo commented on May 29, 2024

@bruno-garcia

Adding these 2 dependencies is not solving the issues for me, the error is still there.

I think this dependency error is a little different than the one in the above link.

from sentry-xamarin.

bruno-garcia avatar bruno-garcia commented on May 29, 2024

@huyvuskedulo do you already specify System.Text.Json version 5.0.0 directly on your project?

from sentry-xamarin.

huyvuskedulo avatar huyvuskedulo commented on May 29, 2024

@bruno-garcia Yes i did, actually that was the first thing i tried to do, you can try my repo above, and you will be able to reproduce it immediately

from sentry-xamarin.

bruno-garcia avatar bruno-garcia commented on May 29, 2024

Thanks for the repro. We'll take a look at it

from sentry-xamarin.

huyvuskedulo avatar huyvuskedulo commented on May 29, 2024

Thanks @bruno-garcia , let me know if you can find out anything :D

from sentry-xamarin.

lucas-zimerman avatar lucas-zimerman commented on May 29, 2024

I'll give a look at it : )

as a workaround, you could try disabling the cache to your Sentry options:

            SentryXamarin.Init(ops => {
                ops.Debug = true;
                ops.Dsn = "...";
                ops.AddXamarinFormsIntegration();
                ops.DisableOfflineCaching();
            });

This will disable the log of events/errors offline but also may lead to not registering unhandled exceptions...

We'll keep investigating this issue :)

from sentry-xamarin.

huyvuskedulo avatar huyvuskedulo commented on May 29, 2024

Hi @lucas-zimerman .

Thanks for the workaround, but since offline mode and registering unhandled exceptions are vital in our apps, so we can't ignore that :).

We're having a plan for migrating into Sentry, but until these issues are fixed, we can't do it yet.

from sentry-xamarin.

bruno-garcia avatar bruno-garcia commented on May 29, 2024

Worth adding to the docs under Troubleshooting

from sentry-xamarin.

bruno-garcia avatar bruno-garcia commented on May 29, 2024

The findings from this thread are not on the troubleshooting page. Please let us know if anything else comes up:

https://docs.sentry.io/platforms/dotnet/guides/xamarin/troubleshooting/

from sentry-xamarin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.