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
[android] Identified crash in toolbar extensions when using a custom image source #22138
Comments
/similarissues |
Hi I'm an AI powered bot that finds similar issues based off the issue title. Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you! Open similar issues:
Closed similar issues:
|
The repro is in the comment. Along with the line where the bug is. |
@softlion can you attach a full project please? |
Man, the issue is so obvious - I pointed the exact line in the maui source code - that i won't spend 1 more hour on it. The maui code voluntarily ignores the null return value with an exclamation mark. If it can return null, why ignore it ? I'm the publisher of a custom component that creates a full custom imagesource with a custom android Drawable. |
Good to hear! |
Do you have a financial bonus when you close an issue ? I would like to understand why you dont add a |
Description
On Android, when using a custom image source as the source for an IconImageSource of a Toolbar item, and that source does not implement GetConstantState, maui crashes:
Steps to Reproduce
The issue is caused by the code in
https://github.com/dotnet/maui/blob/main/src/Controls/src/Core/Platform/Android/Extensions/ToolbarExtensions.cs
which ignores the null value returned by
baseDrawable.GetConstantState()
as not all custom drawable implements that caching feature.Instead, it should not ignore the null value, and provides an alternate implementation when GetConstantState() returns null
Link to public reproduction project repository
No response
Version with bug
8.0.21 SR4.1
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android all versions
Did you find any workaround?
no
Relevant log output
The text was updated successfully, but these errors were encountered: