-
-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.MethodAccessException MAUI app startup crash #3975
Comments
Hm, very curious. We did add some code to wire up an internal before send event handler in 5.1.1 (in the SentrySdk class): But that new code doesn't refer to
Do you have a custom BeforeSend event handler configured? Is it possible your own code is trying to access that member? |
I do not have a BeforeSend handler, and I can't think of anything in my code that would try to access that member. My initialization code is as follows:
|
Thanks @plequere-ms. I can't immediately see how/where this might be happening and it's difficult to investigate without being able to reproduce it. If anyone can figure out how to reproduce this then we can look into it further. |
Not sure if related, but after upgrading to latest Version - I also have a crash at startup in Android + iOS - it says the DSN is not configured ( which it is, we didnt change anything) - after reverting to previous version 5.1.0 it seems to be okay Will later open a new issue if necessary |
Not related no... but also inexplicable. There's nothing in the 5.1.1 release that should cause that. Are you able to open a new issue with a small sample app that demonstrates the issue you're describing? |
Yes! I'll try by end of the week - Still have to do more testing in my app, and then I can try a small repo + some crash logs to be sure |
Thanks @bcaceiro ! For this |
@plequere-ms @bcaceiro This looks to be a case of the compiler trimming things it shouldn't. My suggestion is to look at: https://learn.microsoft.com/en-us/dotnet/maui/deployment/trimming?view=net-maui-9.0 - specifically: "Preserve assemblies, types, and members" section. For your MAUI projects, I would suggest adding the following csproj <ItemGroup>
<TrimmerRootDescriptor Include="Linker.xml" />
</ItemGroup> The XML file <?xml version="1.0" encoding="UTF-8" ?>
<linker>
<assembly fullname="Sentry" preserve="all" />
<assembly fullname="Sentry.Bindings.Android" preserve="all" />
</linker> |
@aritchie Can still report this exact same issue, with trimming being disabled... |
@dartasen thank you for the update. Did you try the linker configuration though? That isn't disabling the trimmer really. Can you provide any sort of sample we can look at? |
We have been getting these at a very high consistency as well. I tried implementing those linker configurations, but it had no effect sadly. We are also not using any sort of CustomSend and are using these options:
|
@obriejas We haven't been able to reproduce this on our end. Are you able to provide a reproducible sample? |
I'm also having this MethodAccessException, and app crashing on startup, with version 5.2.0. |
I think we're still kind of stuck without a minimal repro to step through this locally. Any help would be very appreciated. |
I wonder if we need to stop binding the native event to C#'s That would mean native events don't have a |
Package
Sentry
.NET Flavor
.NET
.NET Version
9.0.0
OS
Android
SDK Version
5.1.1
Self-Hosted Sentry Version
No response
Steps to Reproduce
Since upgrading Sentry.Maui from 5.1.0 to 5.1.1, I am occasionally seeing the following crash:
System.MethodAccessException: Method
Android.Runtime.AndroidEnvironmentInternal.UnhandledException(System.Exception)' is inaccessible from methodSentry.JavaSdk.SentryOptions+IBeforeSendCallbackInvoker.n_Execute_Lio_sentry_SentryEvent_Lio_sentry_Hint__mm_wrapper(intptr,intptr,intptr,intptr)'
Unfortunately, I don't have a good repro. This only happens occasionally. Empirical evidence seems to suggest that this might have something to do with network conditions, but that's merely a guess.
My app builds with the following settings, which might be relevant:
Please let me know if I can provide any additional information.
Expected Result
No crash :)
Actual Result
App crashes immediately upon startup.
https://sound-imagineers-llc.sentry.io/issues/6306102051/?project=4503996749643777&query=is%3Aunresolved%20issue.priority%3A%5Bhigh%2C%20medium%5D&referrer=issue-stream&statsPeriod=90d&stream_index=0
The text was updated successfully, but these errors were encountered: