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

[Bug] [macOS] [XF 5.0] App crash when rendering label with FormattedText #12259

Closed
Seuleuzeuh opened this issue Sep 25, 2020 · 2 comments · Fixed by #13529 · May be fixed by aleks-ivanov/maui#9
Closed

[Bug] [macOS] [XF 5.0] App crash when rendering label with FormattedText #12259

Seuleuzeuh opened this issue Sep 25, 2020 · 2 comments · Fixed by #13529 · May be fixed by aleks-ivanov/maui#9

Comments

@Seuleuzeuh
Copy link

Seuleuzeuh commented Sep 25, 2020

Description

App crash when display the default main page of a newly Xamarin project.

System.InvalidOperationException
Cannot convert a NSColorType.Catalog color without specifying the color space, use the overload to specify an NSColorSpace

System.InvalidOperationException: Cannot convert a NSColorType.Catalog color without specifying the color space, use the overload to specify an NSColorSpace
at Xamarin.Forms.Platform.MacOS.ColorExtensions.ToColor (AppKit.NSColor color) [0x0000a] in <0f206d9b19e34bb492c169092feaa0b2>: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) [0x000d8] in <0f206d9b19e34bb492c169092feaa0b2>: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 <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.LabelRenderer.UpdateFormattedText () [0x00033] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.LabelRenderer.UpdateTextPlainText () [0x0004d] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.LabelRenderer.UpdateText () [0x0001e] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.LabelRenderer.OnElementChanged (Xamarin.Forms.Platform.MacOS.ElementChangedEventArgs1[TElement] e) [0x0008c] in <0f206d9b19e34bb492c169092feaa0b2>:0 at Xamarin.Forms.Platform.MacOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x0017a] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.MacOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <0f206d9b19e34bb492c169092feaa0b2>:0 at Xamarin.Forms.Platform.MacOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <0f206d9b19e34bb492c169092feaa0b2>:0 at Xamarin.Forms.Platform.MacOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in <0f206d9b19e34bb492c169092feaa0b2>:0 at Xamarin.Forms.Platform.MacOS.VisualElementPackager.Load () [0x0001e] in <0f206d9b19e34bb492c169092feaa0b2>:0 at Xamarin.Forms.Platform.MacOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x0012e] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.MacOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003e] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.VisualElementPackager.Load () [0x0001e] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.PageRenderer.Init () [0x0001b] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.PageRenderer.ViewWillAppear () [0x00000] in <0f206d9b19e34bb492c169092feaa0b2>:0
at at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(intptr,intptr,intptr)
at AppKit.NSWindow.set_ContentViewController (AppKit.NSViewController value) [0x00025] in /Library/Frameworks/Xamarin.Mac.framework/Versions/6.20.2.2/src/Xamarin.Mac/AppKit/NSWindow.g.cs:8558
at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.UpdateMainPage () [0x00034] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.SetMainPage () [0x00000] in <0f206d9b19e34bb492c169092feaa0b2>:0
at Xamarin.Forms.Platform.MacOS.FormsApplicationDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00041] in <0f206d9b19e34bb492c169092feaa0b2>:0
at XFCrashRepro.MacOS.AppDelegate.DidFinishLaunching (Foundation.NSNotification notification) [0x00013] in /Users/chaton/Projects/XFCrashRepro/XFCrashRepro.MacOS/AppDelegate.cs:31
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.20.2.2/src/Xamarin.Mac/AppKit/NSApplication.cs:109
at XFCrashRepro.MacOS.MainClass.Main (System.String[] args) [0x00017] in /Users/chaton/Projects/XFCrashRepro/XFCrashRepro.MacOS/Main.cs:11

Note : I was initially tested an issue with custom font integration but a first problem has appeared.

Steps to Reproduce

Use the attached repo and just launch it. If you comment the label with the FormatedText in the MainPage the app launch without crashing.

Basic Information

  • Version with issue: 5.0.0.1487-pre1
  • Last known good version: 4.8
  • IDE: Visual Studio Enterprise 2019 for Mac. Version 8.7.8 (build 4)
  • Platform Target Frameworks:
    • macOS : Version: 6.20.2.2
  • Nuget Packages: Xamarin.Forms 5.0.0.1487-pre1

Reproduction Link

XFCrashRepro.zip

@Seuleuzeuh Seuleuzeuh added s/unverified New report that has yet to be verified t/bug 🐛 labels Sep 25, 2020
@samhouts samhouts added this to New in Triage Sep 25, 2020
@hartez hartez changed the title [Bug] [macOS] [XF 5.0] App crash when rendering label with FormatedText [Bug] [macOS] [XF 5.0] App crash when rendering label with FormattedText Oct 1, 2020
@hartez hartez removed the s/unverified New report that has yet to be verified label Oct 1, 2020
@hartez hartez added this to To do in Other Ready For Work via automation Oct 1, 2020
@hartez hartez added the e/4 🕓 4 label Oct 1, 2020
@hartez hartez removed this from New in Triage Oct 1, 2020
@beeradmoore
Copy link
Contributor

Same issue with 5.0.0.1709-pre4, rolling back to 4.8 allowed my app to run.

@ajtruckle
Copy link

I am new to building MacOS with Xamarin on Visual Studio for Mac and just got this exception too.

See:

https://stackoverflow.com/questions/66128370/how-to-fix-this-exceptioncannot-convert-a-nscolortype-catalog-color-without-spe

Please help.

Other Ready For Work automation moved this from To do to Done Feb 10, 2021
rmarinho added a commit that referenced this issue Feb 10, 2021
* [Controls] Add repo for issue #12259

* [macOS] Fix usage of color extension with ColorSpace
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
5 participants