Description
when using canvas from platform drawables, like in Maui 8.0 GraphicsViewDemos, whenever ImagePain is used on iOS/Mac (works on Android implementation), platform throws:
Object reference not set to an instance of an object. (System.NullReferenceException)
at Microsoft.Maui.Graphics.Platform.PlatformCanvas.DrawImageCallback(CGContext context)
at CoreGraphics.CGPattern.DrawCallback(IntPtr voidptr, IntPtr cgcontextptr) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/CoreGraphics/CGPattern.cs:line 144
at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 58
at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
at GraphicsViewDemos.Program.Main(String[] args) in /Users/blazejewicz/develop/maui-samples/8.0/UserInterface/Views/GraphicsViewDemos/GraphicsViewDemos/Platforms/MacCatalyst/Program.cs:line 13
so here:
|
var platformWrapper = _fillImage.ToPlatformImage() as PlatformImage; |
_fillImage is already released and null.
Steps to Reproduce
- Go to Maui samples
- open
GraphicsViewDemos
- open
Image paint demo page
Should render downsized bot image (as on Android), instead it crashes (image is drawn, but app crashes due to null pointer)
Link to public reproduction project repository
dotnet/maui-samples#336
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS, macOS
Affected platform versions
Mac OS 14, iOS 15
Did you find any workaround?
no
Relevant log output
https://github.com/dotnet/maui-samples/issues/336#issuecomment-1873323734
Description
when using canvas from platform drawables, like in Maui 8.0
GraphicsViewDemos, whenever ImagePain is used on iOS/Mac (works on Android implementation), platform throws:so here:
maui/src/Graphics/src/Graphics/Platforms/MaciOS/PlatformCanvas.cs
Line 644 in 3944004
_fillImageis already released and null.Steps to Reproduce
GraphicsViewDemosImage paint demopageShould render downsized bot image (as on Android), instead it crashes (image is drawn, but app crashes due to null pointer)
Link to public reproduction project repository
dotnet/maui-samples#336
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS, macOS
Affected platform versions
Mac OS 14, iOS 15
Did you find any workaround?
no
Relevant log output