Preview: Xamarin.Forms for macOS

2»

Posts

  • JeffLewisJeffLewis USMember ✭✭

    @rogihee said:
    @JeffLewis: I think there is some progress going on in the desktop-support branch, menu's (main menu bar and context menu's) seem to be have been implemented in Core and MacOS:
    https://github.com/xamarin/Xamarin.Forms/commit/3c46b9c593eb5c6b69c1d590aabcac3a5ae634b4

    Thank you for the pointer, Rogier. I've actually been writing in bits of AppKit code into my Forms app to handle catching keyboard events so I can at least get the shortcuts going.

    Additional info on the ListView problem, it seems that if I refresh the list - even with the exact same data, the problem goes away, which is odd. It suggests there's an initialisation problem in the ListView class.

  • RogerHardimanRogerHardiman GBMember ✭✭

    My Pull Request to fix the important MacOS bug in DisplayActionSheet has been merged into the XamarinForms source on GitHub (the one where it could not handle long lists). The order of the list is still in reverse order to iOS and Android but I can live with that for now.

    It is really handy having the full source to Xamarin Forms on GitHub along with a project to test the GUI. Would have been stuck without it.

  • Nice news!
    Android again pleases all its customers, a new Oreo came out so let's see a review of this miracle: https://www.cleveroad.com/blog/android-8-0-features-and-updates-release-of-new-android-os
    I also suggest to recall not a long but very interesting history of this operating system: https://en.wikipedia.org/wiki/Android_(operating_system)

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    After solving some problems I can compile at last. Unfortunately now I get an exception on startup.

    System.TypeLoadException: Could not resolve type with token 01000120 (from typeref, class/assembly System.Drawing.RectangleF, Xamarin.Mac, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065)
    at Xamarin.Forms.Platform.MacOS.VisualElementTracker.OnUpdateNativeControl (CoreAnimation.CALayer caLayer) [0x001f4] in <2d9ebed16df2477bbf17b5b8974ffe3d>:0
    at Xamarin.Forms.Platform.MacOS.VisualElementTracker.UpdateNativeControl () [0x00038] in <2d9ebed16df2477bbf17b5b8974ffe3d>:0
    ...
    at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.SetMainPage () [0x00000] in <2d9ebed16df2477bbf17b5b8974ffe3d>:0
    at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00041] in <2d9ebed16df2477bbf17b5b8974ffe3d>:0
    at GestureSample.MacOS.AppDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00013] in /Users/Michael/Documents/dev/GestureSample_Git/GestureSample/GestureSample.MacOS/AppDelegate.cs:31

    I have the alpha channel in VS Mac (Version 7.2 Preview (7.2 build 634)), Xamarin.Mac 3.8.0.49 and XF 2.4.0.280.

    This is my first try in VS Mac. I usually work in VS for Windows. So I may miss something which is obvious for everybody else.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    I changed a ton of things, but I think the problem was a reference to System.Drawing in my Mac project. No idea where that came from. I didn't use System.Drawing.RectangleF or any other type from that dll myself.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    So up to the next problem.

    @DavidOrtinau , you wrote in your blog post that NuGet package authors must target xamarinmac20 in order to get installed to the mac project. How exactly do I do that?

    I wrote in my .nuspec:

    <file src="..\MR.Gestures.MacOS\bin\Release\MR.Gestures.MacOS.dll" target="lib\xamarinmac20" />
    <file src="..\MR.Gestures\bin\Release\MR.Gestures.dll" target="lib\xamarinmac20" />
    <file src="..\MR.Gestures\bin\Release\MR.Gestures.XML" target="lib\xamarinmac20" />
    

    I also tried lib\Xamarin.Mac like you used in your own Xamarin.Forms.nuspec. Both versions add the files to the .nupkg file in the respective folder, but when I try to install the package to the macOS project, only the reference to MR.Gestures.dll (the PCL project) is added, but not MR.Gestures.MacOS.dll. The file MR.Gestures.XML is also copied to the target folder.

    What else do I have to do for this .dll to be deployed to my macOS project?

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭
    edited October 2017

    Another problem that I have is with compiling only on the Mac.

    My MR.Gestures solution has a project for every platform - from Windows Phone 8 Silverlight up to macOS. But I can't compile the whole solution anymore. If I want to make a NuGet package, I have to compile the macOS project on the Mac, copy the dll over to Windows, then compile the rest and run NuGet.exe pack there.

    I do understand that you won't add tooling support for WinPhone 8 and Windows Runtime anymore to VS for Mac, but macOS and UWP (and all others) should be compilable on one platform.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    I may be doing something out of the ordinary here, but I used a NavigationPage and PushAsync to switch to another ContentPage. The content of the second page is not displayed. Just the header and Title are changed. Filed bug 60021.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭
    edited October 2017

    The Mac has its 0/0 coordinates at the LOWER left corner. Everybody else on earth has 0/0 at the top left.

    This makes platform independent code using AbsoluteLayout, RelativeLayout, TranslationY or AnchorY impossible. As XF wants to be a cross platform framework, you should flip the coordinates.

    As I see it every view needs to return true from its IsFlipped property. That would mean that every renderer needs to override that property and every other views which will be shown too. I hope there's an easier way to do this. That would be quite some effort.

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    Next one:

    I have a NavigationPage, push a TabbedPage and when I try to go back and close the TabbedPage, the app crashes with this exception:

    [ERROR] FATAL UNHANDLED EXCEPTION: System.ObjectDisposedException: Cannot access a disposed object.
    Object name: 'TabbedPageRenderer'.
    at Foundation.NSObject.get_SuperHandle () [0x00021] in /Users/builder/data/lanes/5489/697f665b/source/xamarin-macios/src/Foundation/NSObject2.cs:416
    at AppKit.NSViewController.get_View () [0x00030] in /Users/builder/data/lanes/5489/697f665b/source/xamarin-macios/src/build/mac/mobile/AppKit/NSViewController.g.cs:1147
    at Xamarin.Forms.Platform.MacOS.TabbedPageRenderer.get_NativeView () [0x00000] in :0
    at Xamarin.Forms.Platform.MacOS.Platform.DisposeRendererAndChildren (Xamarin.Forms.Platform.MacOS.IVisualElementRenderer rendererToRemove) [0x0002a] in :0
    at Xamarin.Forms.Platform.MacOS.NavigationPageRenderer+<>c__DisplayClass44_0.b__0 () [0x00000] in :0
    at Xamarin.Forms.Platform.MacOS.NSViewControllerExtensions+<>c__DisplayClass0_0`1[T].b__0 () [0x0001b] in :0
    at ObjCRuntime.Trampolines+SDAction.Invoke (System.IntPtr block) [0x0001b] in /Users/builder/data/lanes/5489/697f665b/source/xamarin-macios/src/build/mac/mobile/ObjCRuntime/Trampolines.g.cs:10623
    at (wrapper managed-to-native) AppKit.NSApplication:NSApplicationMain (int,string[])
    at AppKit.NSApplication.Main (System.String[] args) [0x00041] in /Users/builder/data/lanes/5489/697f665b/source/xamarin-macios/src/AppKit/NSApplication.cs:100
    at GestureSample.MacOS.MainClass.Main (System.String[] args) [0x00017] in /Users/Michael/Documents/dev/GestureSample_VS/GestureSample/GestureSample.MacOS/Main.cs:11

  • pierreDurantpierreDurant USMember ✭✭

    Hello !

    First of all: thanks for porting Forms on Mac ! Great work.
    But for my app, I really need "ScrollTo" for my ListView... It seems that this is not implemented.
    Question: when di you plan to implement the "ScrollTo" ?

    Thanks

    Pierre

  • pierreDurantpierreDurant USMember ✭✭

    Another question: is there a device (like "iOS") that I can use in my XAML file with "OnPlatform" for MacOS in order to detect that I'm or not on this platform ? I didn't find it...

    Pierre

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    I filed a couple of bugs:

    • 60510: [MacOS] Stepper wraps from Minimum to Maximum and vice versa
    • 60511: Slider.Minimum > 0 crashes
    • 60512: Slider: circle is not at the right position
    • 60513: [MacOS] TimePicker raises PropertyChanged before it changes Time
    • 60515: [MacOS] closing a TabbedPage crashes with an ObjectDisposedException
    • 60516: [MacOS] cannot focus an EntryCell

    I can only file 2 bugs within 16 minutes. If you want to protect from spam, then you should probably build less bugs in your software.

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @MichaelRumpler thanks for filing them! I'd much rather be fielding bugs in this preview than once we remove that label and declare it stable!

  • JimBordenJimBorden USMember ✭✭

    What ever happened to that commit with the menus that you references before? Was it abandoned?

  • pierreDurantpierreDurant USMember ✭✭

    another problem: crash when using the message center.
    with IOS or android, no problem.
    on MacOS: the message is sent & received. The action is performed.
    But when back just after the message sending (MessagingCenter.Send...) => crash !
    I don't know if this problem has already been pointed, but it should be.

    Pit

  • pierreDurantpierreDurant USMember ✭✭

    HI all
    I have a problem with forms for MacOS and the "Messaging Center" !
    I define some message in a page in order to be able to call some functions of this page from other page.
    Example:
    MessagingCenter.Subscribe<SettingsPage>(this, "Nouveau", (sender) => { Nouveau(); });

    this works absolutely fine in my IOS & Android versions.
    But not with the MacOS version.

    • the message is sent : OK
    • the function linked to the message si well executed: OK
    • BUT just after (when the program must "go back" to the initial page): CRASH
      at "NSApplication.Main(args);" in the main class
      Here is the error message:
      "System.Reflection.TargetInvocationException
      Exception has been thrown by the target of an invocation."

    iOS there something more to do on MAcOS in order to use the "messaging Center" ?
    Or is it a problem in the "preview version" ?

    other thing: any idea when the "ScrollTo" for ListView will be implemented ?

    Cheers

    Pierre

  • pierreDurantpierreDurant USMember ✭✭

    @DavidOrtinau David, is this forum still the place to post the problems with MacOS release ?
    Or is there another place to post our problems ?

    Cheers

    Pierre

  • SoreyGarciaSoreyGarcia COUniversity ✭✭

    Hi guys,
    Somebody knows which is the latest version that work for mac? I updated to the last Xamarin Forms version and with a simple Hello World sample, the app is broken, I change the version for the first one that supports it and the sample sample works fine. Any idea?

  • AlexandrBykovAlexandrBykov BYMember ✭✭

    Hi guys.. I'm trying to play with tutorial "Preview: Bringing macOS to Xamarin.Forms"

    I'm using the latest stable Xamarin.Forms 2.5, when I'm trying to run Mac app created by following all the steps in tutorial, it crashes with NullReferenceException, stacktrace shows the following error:

    System.NullReferenceException: Object reference not set to an instance of an object
      at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.UpdateMainMenu () [0x00021] in <3be6574b266448adae13c61e3dfd820f>:0
      at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00047] in <3be6574b266448adae13c61e3dfd820f>:0
      at NightNotes.Mac.AppDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00013] in /Users/bykov/BykovSoft/Projects/NightNotes/NightNotes/NightNotes.Mac/AppDelegate.cs:30
      at at (wrapper managed-to-native) AppKit.NSApplication:NSApplicationMain (int,string[])
      at AppKit.NSApplication.Main (System.String[] args) [0x00041] in /Users/builder/data/lanes/5143/124197ee/source/xamarin-macios/src/AppKit/NSApplication.cs:100
    

    Could you advice how to fix?

    Thanks!

  • ThomasGoerlichThomasGoerlich DEMember ✭✭
    edited December 2017

    @AlexandrBykov
    I got the same error. I got rid of it by right clicking the Solution, going to Build -> Configurations -> ConfigurationMappings and change the Configuration for the Mac to either Debug or Release (it was Debug/Release|iPhoneSimulator in my case before). Now the app builds for me but closes immediately after the start. So I'm not really sure if it helps you out or not but I thought I would at least share my findings so far.

    EDIT
    Sorry I just saw that the error still shows up in the output window. I totally missed that.

    EDIT #2
    The bug is already known for over a month. Only mentioned workaround is downgrading to 2.4.x: https://bugzilla.xamarin.com/show_bug.cgi?id=60370

  • ThomasGoerlichThomasGoerlich DEMember ✭✭

    @AlexandrBykov said:
    Hi guys.. I'm trying to play with tutorial "Preview: Bringing macOS to Xamarin.Forms"

    I'm using the latest stable Xamarin.Forms 2.5, when I'm trying to run Mac app created by following all the steps in tutorial, it crashes with NullReferenceException, stacktrace shows the following error:

    System.NullReferenceException: Object reference not set to an instance of an object
      at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.UpdateMainMenu () [0x00021] in <3be6574b266448adae13c61e3dfd820f>:0
      at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00047] in <3be6574b266448adae13c61e3dfd820f>:0
      at NightNotes.Mac.AppDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00013] in /Users/bykov/BykovSoft/Projects/NightNotes/NightNotes/NightNotes.Mac/AppDelegate.cs:30
      at at (wrapper managed-to-native) AppKit.NSApplication:NSApplicationMain (int,string[])
      at AppKit.NSApplication.Main (System.String[] args) [0x00041] in /Users/builder/data/lanes/5143/124197ee/source/xamarin-macios/src/AppKit/NSApplication.cs:100
    

    Could you advice how to fix?

    Thanks!

    FYI the bug is supposed to be fixed as stated in the bugzilla report (https://bugzilla.xamarin.com/show_bug.cgi?id=60370) in the 2.5.1 nightly version (not sure if/how we could try that ourself).

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @ThomasGoerlich this is the guide on accessing "nightly" builds. https://github.com/xamarin/Xamarin.Forms/wiki/Nightly-Builds

  • ThomasGoerlichThomasGoerlich DEMember ✭✭

    @DavidOrtinau said:
    @ThomasGoerlich this is the guide on accessing "nightly" builds. https://github.com/xamarin/Xamarin.Forms/wiki/Nightly-Builds

    Thanks David. I tried that yesterday after finding your blog post (https://blog.xamarin.com/try-the-latest-in-xamarin-forms-with-nightly-builds/). The problem for me was that i didn't see the nightly versions in Visual Studio for Mac. I just tried it on my work PC and it worked. I'll try it again with my mac when i'm home.

  • YFerrandoYFerrando USMember ✭✭

    @AlexandrBykov @ThomasGoerlich NSApplication.SharedApplication.MainMenu = new NSMenu(); on AppDelegate constructor fix the issue on 2.5.0.121934

  • ThomasGoerlichThomasGoerlich DEMember ✭✭

    @YFerrando Oh that is great, thanks for mentioning this workaround.

  • Felix.xFelix.x USMember ✭✭

    Is this still preview?

  • PhilSeemanPhilSeeman USMember ✭✭

    I added a MacOS project to a Xamarin Forms solution as described here and I'm getting the same error that @JamesGreen.8031 was getting above:

    Error MM0023: Application name 'MyAppName.exe' conflicts with another user assembly. (MM0023)
    

    This is using Xamarin Forms 2.5.0.1.22203.

    Anyone have any solutions/suggestions for resolving this error?

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭

    @PhilSeeman said:
    I added a MacOS project to a Xamarin Forms solution as described here and I'm getting the same error that @JamesGreen.8031 was getting above:

    Error MM0023: Application name 'MyAppName.exe' conflicts with another user assembly. (MM0023)
    

    I got the same problem. It seems like you cannot name your executable the same as another dll.

    Usually you have a PCL (or .NET Standard now) called MyAppName and your MacOS project is called something like MyAppName.MacOS. The PCL will be compiled to MyAppName.dll and the MacOS project to MyAppName.exe. This is not allowed on the Mac. The thing is too stupid to distinguish between the MyAppName.dll and MyAppName.exe.

    You have to rename your projects and/or executable names in the project options.
    This also means that you have to change the names in your InternalsVisibleToAttribute if you use that.

  • PhilSeemanPhilSeeman USMember ✭✭

    Thanks @MichaelRumpler , you were right - I renamed my Assembly name under Options > Build > Output and that did the trick. That blog post really should have mentioned this necessary step.

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @Felix.x said:
    Is this still preview?

    It is. See the status on our wiki.

  • DavidOrtinauDavidOrtinau USForum Administrator, Xamarin Team, Insider, University Xamurai

    @PhilSeeman said:
    Thanks @MichaelRumpler , you were right - I renamed my Assembly name under Options > Build > Output and that did the trick. That blog post really should have mentioned this necessary step.

    I'll review it and add a note. I've done several projects and not run into that issue.

2»
Sign In or Register to comment.