dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.21k stars 1.75k forks source link

ICanvas DrawString does not work on MacCatalyst platform #15370

Closed grempel closed 1 year ago

grempel commented 1 year ago

DrawString tosses an exception every Time. "Value cannot be null. (Parameter 'handle').

Any plans to fix this? This is a complete lack of functionality. For my app its a show stopper.

Thanks, Gerry

The code is too simple to require a sample.

ghost commented 1 year ago

Hi @grempel. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

drasticactions commented 1 year ago

Test Image

https://github.com/drasticactions/MauiRepros/tree/main/MauiDrawString

Workload List

wasm-tools              7.0.5/7.0.100          SDK 7.0.200
macos                   13.3.7060/7.0.100      SDK 7.0.200
ios                     16.4.7060/7.0.100      SDK 7.0.200
maccatalyst             16.4.7060/7.0.100      SDK 7.0.200
maui                    7.0.86/7.0.100         SDK 7.0.200
tvos                    16.4.7060/7.0.100      SDK 7.0.200
android                 33.0.46/7.0.100        SDK 7.0.200

I can use DrawString without issues on Mac Catalyst, using the newest MAUI stable release. Can you try my reproduction sample to see if it works for you? It could be that you're using an older version, or you could have done other things within your code that is causing DrawString to throw (Maybe setting a font?), which could be a bug we can look at. This is generally why we request repro projects, so we can make sure that all sides can recognize the bug and validate it.

grempel commented 1 year ago

Net Maui has two DrawString methods on ICanvas. The one that takes a bounding box works. The one that takes only the starting X and Y location of the string does not work and tosses an exception every time when run on MacCatalyst.

Tim's example above uses the bounding box DrawString and works properly. I've changed my code to use this as well. The bug remains - only 50% of your DrawString methods work on the MacCatalyst platform.

Thanks, Gerry

ghost commented 1 year ago

Hi @grempel. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

drasticactions commented 1 year ago

Sample

I updated my sample and while it didn't draw the string (which makes sense I think, as it's not bound to any width or height) nothing was thrown.

I don't doubt you're seeing an exception, but this is why we need reproducible samples so we can see if this is something local to your setup or if everyone else can hit the same thing you are.

drasticactions commented 1 year ago

@mattleibow Would you have any tips for this?

mattleibow commented 1 year ago

I can have a look at why nothing is drawn in the overload, but for the exception we will need a repro as you said.

ghost commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.