Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] MacOS LabelRenderer crashes with NSInvalidArgumentException #11248

Closed
IntegerOverlord opened this issue Jun 30, 2020 · 0 comments
Closed
Assignees
Labels
a/label i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often in-progress This issue has an associated pull request that may resolve it! p/macOS t/bug 🐛
Projects

Comments

@IntegerOverlord
Copy link

IntegerOverlord commented Jun 30, 2020

Description

I create a new project using Master-Details app template for Xamarin.Forms. Then I added the UWP project. That worked fine. I decided to proceed with the macOS project and added it using this tutorial:
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/mac

The app looks wrong, there is nothing on the browse page and when I click on about page, it crashes somewhere inside of LabelRenderer because of colorspace issues, here is the full stacktrace

Foundation.ObjCException: NSInvalidArgumentException: *** -getRed:green:blue:alpha: not valid for the NSColor Generic Gray Gamma 2.2 Profile colorspace 0 1; need to first convert colorspace.
  at at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_out_nfloat_out_nfloat_out_nfloat_out_nfloat(intptr,intptr,System.nfloat&,System.nfloat&,System.nfloat&,System.nfloat&)
  at AppKit.NSColor.GetRgba (System.nfloat& red, System.nfloat& green, System.nfloat& blue, System.nfloat& alpha) [0x0000c] in /Library/Frameworks/Xamarin.Mac.framework/Versions/6.18.2.1/src/Xamarin.Mac/NSColor.g.cs:944
  at Xamarin.Forms.Platform.MacOS.ColorExtensions.ToColor (AppKit.NSColor color) [0x00015] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.FormattedStringExtensions.ToAttributed (Xamarin.Forms.Span span, Xamarin.Forms.BindableObject owner, Xamarin.Forms.Color defaultForegroundColor, Xamarin.Forms.TextAlignment textAlignment, System.Double lineHeight) [0x000c0] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.FormattedStringExtensions.ToAttributed (Xamarin.Forms.FormattedString formattedString, Xamarin.Forms.BindableObject owner, Xamarin.Forms.Color defaultForegroundColor, Xamarin.Forms.TextAlignment textAlignment, System.Double lineHeight) [0x0001b] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.LabelRenderer.UpdateFormattedText () [0x00033] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.LabelRenderer.UpdateTextPlainText () [0x0004d] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.LabelRenderer.UpdateText () [0x0001e] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.LabelRenderer.OnElementChanged (Xamarin.Forms.Platform.MacOS.ElementChangedEventArgs`1[TElement] e) [0x0008c] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x0012a] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.MacOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementPackager.Load () [0x0001e] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000de] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.MacOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.ScrollViewRenderer.PackContent () [0x00050] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.ScrollViewRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0007a] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementPackager.Load () [0x0001e] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000de] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.MacOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.VisualElementPackager.Load () [0x0001e] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.PageRenderer.Init () [0x0001b] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.PageRenderer.ViewWillAppear () [0x00000] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSendSuper_IntPtr(intptr,intptr,intptr)
  at AppKit.NSSplitViewController.AddSplitViewItem (AppKit.NSSplitViewItem splitViewItem) [0x00040] in /Library/Frameworks/Xamarin.Mac.framework/Versions/6.18.2.1/src/Xamarin.Mac/NSSplitViewController.g.cs:192
  at Xamarin.Forms.Platform.MacOS.MasterDetailPageRenderer.UpdateControllers () [0x00103] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at Xamarin.Forms.Platform.MacOS.MasterDetailPageRenderer.OnElementPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x0002d] in <991a47b39fdd4961815c2a0c3fd4013b>:0
  at at (wrapper delegate-invoke) <Module>.invoke_void_object_PropertyChangedEventArgs(object,System.ComponentModel.PropertyChangedEventArgs)
  at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00012] in <ecdf7a4e40074fd9b917662aa85cffcd>:0
  at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in <ecdf7a4e40074fd9b917662aa85cffcd>:0
  at Xamarin.Forms.MasterDetailPage.set_Detail (Xamarin.Forms.Page value) [0x00075] in <ecdf7a4e40074fd9b917662aa85cffcd>:0
  at uwp_xamarin_test.Views.MainPage.NavigateFromMenu (System.Int32 id) [0x000de] in /Users/maksymfedoriaka/Projects/uwp-test/uwp-xamarin-test/uwp-xamarin-test/Views/MainPage.xaml.cs:46
  at uwp_xamarin_test.Views.MenuPage.<.ctor>b__3_0 (System.Object sender, Xamarin.Forms.SelectedItemChangedEventArgs e) [0x0005d] in /Users/maksymfedoriaka/Projects/uwp-test/uwp-xamarin-test/uwp-xamarin-test/Views/MenuPage.xaml.cs:36
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00002] in /Library/Frameworks/Xamarin.Mac.framework/Versions/6.18.2.1/src/Xamarin.Mac/Foundation/NSAction.cs:178
  at at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[])
  at AppKit.NSApplication.Main (System.String[] args) [0x00040] in /Library/Frameworks/Xamarin.Mac.framework/Versions/6.18.2.1/src/Xamarin.Mac/AppKit/NSApplication.cs:109
  at uwpxamarintest.macOS.MainClass.Main (System.String[] args) [0x00017] in /Users/maksymfedoriaka/Projects/uwp-test/uwp-xamarin-test.macOS/Main.cs:11

Steps to Reproduce

  1. Create a new Xamarin.Forms project using Master-Details template
  2. Add macOS project following this tutorial: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/platform/other/mac
  3. Build the app
  4. Press "About"

Expected Behavior

About page is displayed

Actual Behavior

App crashes

Basic Information

  • Version with issue:
  • Last known good version: none
  • IDE: Visual Studio for Mac 2019 Community v8.6.5 (build 23)
  • Platform Target Frameworks:
    • macOS 10.15
  • Nuget Packages:
    Xamarin Essentials 1.5.3.2

Screenshots

image

Reproduction Link

Here is my test project you can download and run
uwp-test.zip

@IntegerOverlord IntegerOverlord added s/unverified New report that has yet to be verified t/bug 🐛 labels Jun 30, 2020
@pauldipietro pauldipietro added this to New in Triage Jun 30, 2020
@jsuarezruiz jsuarezruiz added p/macOS i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often labels Jun 30, 2020
@jsuarezruiz jsuarezruiz self-assigned this Jul 3, 2020
@jsuarezruiz jsuarezruiz removed the s/unverified New report that has yet to be verified label Jul 3, 2020
@jsuarezruiz jsuarezruiz moved this from New to Needs Estimate in Triage Jul 3, 2020
@rmarinho rmarinho moved this from Needs Estimate to Ready For Work in Triage Jul 3, 2020
@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Jul 3, 2020
@samhouts samhouts added this to In Progress in 4.7.0 Jul 3, 2020
Triage automation moved this from Ready For Work to Closed Jul 3, 2020
4.7.0 automation moved this from In Progress to Done Jul 3, 2020
@samhouts samhouts removed this from Closed in Triage Aug 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/label i/high Completely doesn't work, crashes, or is unusably slow, has no obvious workaround; occurs less often in-progress This issue has an associated pull request that may resolve it! p/macOS t/bug 🐛
Projects
No open projects
4.7.0
  
Done
Development

No branches or pull requests

3 participants