AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.06k stars 2.25k forks source link

Support `netX.0-maccatalyst` target framework #16212

Open JaneySprings opened 4 months ago

JaneySprings commented 4 months ago

Is your feature request related to a problem? Please describe.

Hi! I'm a creator of .NET Meteor extension for VSCode. I want to add an Avalonia support for it. Now it already works with iOS and Android platforms (Debugging + Profiling):

Screenshot 2024-07-03 at 11 01 20 Screenshot 2024-07-03 at 11 07 29

But the Desktop application is not working right now. The netX.0-macos target framework, as I understand it, does not contain Mono libraries. I changed it to net8.0-maccatalyst but it threw an InvalidOperationException:

image

Describe the solution you'd like

No InvalidOperationException if you use the netX.0-maccatalyst target framework.

Describe alternatives you've considered

_

Additional context

No response

maxkatz6 commented 4 months ago

@JaneySprings maccatalyst is basically a mobile target. It might work if you use Avalonia.iOS as well as running it from the same template as iOS.

Last time I checked, there was a blocked in Skia, which didn't support MacCatalyst well until newer version available in SkiaSharp 3.0. You can install it and use as described here https://github.com/AvaloniaUI/Avalonia/issues/15503

There was an idea to add "netX.0-maccatalyst" target framework to the Avalonia.iOS project as well.

maxkatz6 commented 4 months ago

The netX.0-macos target framework, as I understand it, does not contain Mono libraries.

No, it doesn't. But it should be runnable/debuggable as a normal .NET app, i.e. dotnet run works fine.

JaneySprings commented 4 months ago

But it should be runnable/debuggable as a normal .NET app

Yes, it debuggable only with vsdbg. Mono Debugger doesn't connected to the application.

I compared both output directories for different target frameworks, you may notice that there are no libmono-component-* libraries for netX.0-macos:

Screenshot 2024-07-03 at 12 27 15
maxkatz6 commented 4 months ago

@JaneySprings yes, netX.0-macos apps don't rely on mono runtime at all. So, it's rather a feature and not a bug. The same soon might be the case with iOS as well, as they are adopting NativeAOT and CoreCLR runtime.

JaneySprings commented 4 months ago

Thank you for your response! I will need to explore how to work with vsdbg and be prepared that Microsoft will drop Mono SDB support.