Skip to content
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

AppKit.NSToolbarItem.Image bound incorrectly on MacCatalyst #15068

Closed
praeclarum opened this issue May 19, 2022 · 0 comments · Fixed by #15075
Closed

AppKit.NSToolbarItem.Image bound incorrectly on MacCatalyst #15068

praeclarum opened this issue May 19, 2022 · 0 comments · Fixed by #15075
Labels
bug If an issue is a bug or a pull request a bug fix
Milestone

Comments

@praeclarum
Copy link
Contributor

On MacCatalyst, the Image property of AppKit.NSToolbarItem should be a UIImage: https://developer.apple.com/documentation/appkit/nstoolbaritem/1527749-image

This has been incorrectly bound for all the previews but I used to be able to work around it. In the RCs, GetSystemSymbol was removed from NSImage and I can no longer set toolbar button images. I tried forcing a UIImage in, but that just results in disaster (crash).

Here is old preview code that worked:

    override this.WillInsertItem (toolbar, itemIdentifier, willBeInserted) =
        match itemIdentifier with
        | "com.example.NeuralThings.open" ->
            let item = new AppKit.NSToolbarItem(itemIdentifier, Label = "Open");
            item.Image <- new AppKit.NSImage.GetSystemSymbol("cube", "Open")
            item.ToolTip <- "Open"
            item.Action <- new Selector(AppCommands.openDocumentSel)
            item

AppKit.NSImage should be replaced with UIKit.UIImage.

Steps to Reproduce

  1. Try to build an NSToolbar in a MacCatalyst app using system symbols

Expected Behavior

No problem

Actual Behavior

Can't add system symbol images

Environment

Version information ``` Visual Studio Enterprise 2022 for Mac Preview Version 17.0 Preview (17.0 build 8904) Installation UUID: 54dd163c-d9bf-4043-acf4-fa17e06cda78

Runtime
.NET 6.0.3 (64-bit)
Architecture: X64

Xamarin Designer
Version: 17.1.5.90
Hash: 53f47efde
Branch: remotes/origin/d17-0-vsmac
Build date: 2022-05-05 16:33:50 UTC

Roslyn (Language Service)
4.1.0-3.22075.3+592501cbb9c9394072a245c15b3458ff88155d85

NuGet
Version: 6.0.0.262

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/6.0.300/Sdks
SDK Versions:
6.0.300
6.0.101
6.0.100
5.0.408
5.0.407
5.0.404
5.0.403
5.0.302
5.0.203
5.0.202
5.0.201
5.0.200
5.0.102
5.0.100
3.1.419
3.1.418
3.1.416
3.1.415
3.1.411
3.1.409
3.1.408
3.1.407
3.1.405
3.1.403
3.1.402
3.1.300
3.1.200
3.1.102
3.1.101
3.1.100
3.0.100
2.2.203
2.2.103
2.1.302
2.0.3
MSBuild SDKs: /usr/local/share/dotnet/sdk/6.0.300/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
6.0.5
6.0.1
6.0.0
5.0.17
5.0.16
5.0.13
5.0.12
5.0.3
3.1.25
3.1.24
3.1.22
3.1.21

Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Apple Developer Tools
Xcode 13.3 (20102)
Build 13E113

Xamarin.Mac
Version: 8.10.0.1 (Visual Studio Enterprise)
Hash: 568bdb2
Branch: d17-2
Build date: 2022-04-08 18:52:56-0400

Xamarin.iOS
Version: 15.10.0.1 (Visual Studio Enterprise)
Hash: 568bdb2
Branch: d17-2
Build date: 2022-04-08 18:52:57-0400

Xamarin.Android
Version: 12.3.0.3 (Visual Studio Enterprise)
Commit: xamarin-android/d17-2/bbba5a2
Android SDK: /Users/fak/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
8.0 (API level 26)
12.0 (API level 31)
4.4 (API level 19)
8.1 (API level 27)
11.0 (API level 30)
7.1 (API level 25)
9.0 (API level 28)
7.0 (API level 24)

SDK Command-line Tools Version: 5.0
SDK Platform Tools Version: 31.0.3
SDK Build Tools Version: 30.0.3

Build Information:
Mono: adf1bc4
Java.Interop: xamarin/java.interop/d17-2@9760f0a9
ProGuard: Guardsquare/proguard@912d149
SQLite: xamarin/sqlite@7b1e016
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-2@fc3c2ac

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.2.0.37
Hash: 7f5a6ef
Branch: remotes/origin/d17-2
Build date: 2022-05-05 16:33:55 UTC

Android Device Manager
Version: 0.0.0.1116
Hash: e47e6c8
Branch: remotes/origin/d17-2
Build date: 2022-05-05 16:33:55 UTC

Build Information
Release ID: 1700008904
Git revision: efb2e3cdea6d82dd2bdd17edd3b24d3e15beb630
Build date: 2022-05-05 16:32:15+00
Build branch: release-17.0
Build lane: release-17.0

Operating System
Mac OS X 12.2.1
Darwin 21.3.0 Darwin Kernel Version 21.3.0
Wed Jan 5 21:37:58 PST 2022
root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64

</details>

@rolfbjarne rolfbjarne added this to the Future milestone May 19, 2022
@rolfbjarne rolfbjarne added the bug If an issue is a bug or a pull request a bug fix label May 19, 2022
rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue May 20, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug If an issue is a bug or a pull request a bug fix
Projects
None yet
2 participants