Skip to content

(MAUI) It's hard to know if an event made an app crash #4186

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

Open
lucas-zimerman opened this issue May 13, 2025 · 3 comments
Open

(MAUI) It's hard to know if an event made an app crash #4186

lucas-zimerman opened this issue May 13, 2025 · 3 comments

Comments

@lucas-zimerman
Copy link
Collaborator

https://sentry.lkp.app.br/share/issue/6a79ea41e23348e9ad9680c4887ca800/

System.InvalidOperationException: PlatformView cannot be null here
  ?, in UIImageView ViewHandler<IImage, UIImageView>.get_PlatformView()
  ?, in UIImageView ImageHandler.Microsoft.Maui.Handlers.IImageHandler.get_PlatformView()
  ?, in void ImageImageSourcePartSetter.SetImageSource(UIImage platformImage)
  ?, in async Task<IImageSourceServiceResult<UIImage>> ImageSourcePartExtensions.UpdateSourceAsync(IImageSourcePart image, UIView destinationContext, IImageSourceServiceProvider services, Action<UIImage> setImage, float imageScale, CancellationToken cancellationToken)
  ?, in async Task ImageSourcePartLoader.UpdateImageSourceAsync()
  ?, in async Task ImageHandler.MapSourceAsync(IImageHandler handler, IImage image)
  ?, in async void TaskExtensions.FireAndForget(Task task, Action<Exception> errorCallback)

This issue is marked as unhandled, but the trace shows user used the app after the unhandled exception (all those stacktraces came from the Maui Assembly)

With that said, it's hard to know when an app actually crashed due to an event, that is helpful information to prioritize issues.

@jamescrosswell
Copy link
Collaborator

@lucas-zimerman on iOS we can't use the UnhandledException callback so we use the RuntimeMarshalManagedException callback instead (see #3909).

One of the downsides of this is that the arguments to RuntimeMarshalManagedException don't indicate whether the exception is terminal or not.

We're hoping the root cause gets addressed in .NET 10:

@lucas-zimerman
Copy link
Collaborator Author

would it be possible to mark the issues as unhandled, and after a period of time (lets say 5 seconds) if the code is still functional then mark it again as handled?

@jamescrosswell
Copy link
Collaborator

would it be possible to mark the issues as unhandled, and after a period of time (lets say 5 seconds) if the code is still functional then mark it again as handled?

I don't think so no. In the case that the event does lead to an app crash, we want to try to capture the event as soon as possible. Since we don't know whether the exception is terminal or not, there's no way to work out whether we should send the event immediately or hold it in purgatory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants