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

Can't open in Linux: System.InvalidOperationException: Default font family name can't be null or empty. Trhown when executing #84

Open
zryogi opened this issue Nov 14, 2021 · 4 comments

Comments

@zryogi
Copy link

zryogi commented Nov 14, 2021

Steps to reproduce

  1. Download release from https://github.com/icsharpcode/AvaloniaILSpy/releases/tag/v7.0-rc2 linux-x64.zip
  2. Unzip files
  3. Brwose artifacts/linux-64 folder
  4. Execute ./ILSpy
  5. Get:
Sorry, we crashed
Microsoft.VisualStudio.Composition.CompositionFailedException: An exception was thrown while initializing part "ICSharpCode.ILSpy.TextView.DecompilerTextView".
 ---> System.InvalidOperationException: Default font family name can't be null or empty.
   at Avalonia.Media.FontManager..ctor(IFontManagerImpl platformImpl) in /_/src/Avalonia.Visuals/Media/FontManager.cs:line 31
   at Avalonia.Media.FontManager.get_Current() in /_/src/Avalonia.Visuals/Media/FontManager.cs:line 50
   at Avalonia.Skia.FormattedTextImpl..ctor(String text, Typeface typeface, Double fontSize, TextAlignment textAlignment, TextWrapping wrapping, Size constraint, IReadOnlyList`1 spans) in /_/src/Skia/Avalonia.Skia/FormattedTextImpl.cs:line 24
   at Avalonia.Skia.PlatformRenderInterface.CreateFormattedText(String text, Typeface typeface, Double fontSize, TextAlignment textAlignment, TextWrapping wrapping, Size constraint, IReadOnlyList`1 spans) in /_/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs:line 50
   at Avalonia.Media.FormattedText.get_PlatformImpl() in /_/src/Avalonia.Visuals/Media/FormattedText.cs:line 143
   at Avalonia.Media.FormattedText.get_Bounds() in /_/src/Avalonia.Visuals/Media/FormattedText.cs:line 67
   at AvaloniaEdit.Text.TextLineRun.CreateRunForText(StringRange stringRange, TextRun textRun, Double widthLeft, Boolean emergencyWrap, Boolean breakOnTabs)
   at AvaloniaEdit.Text.TextLineRun.Create(TextSource textSource, StringRange stringRange, TextRun textRun, Int32 index, Double widthLeft)
   at AvaloniaEdit.Text.TextLineRun.Create(TextSource textSource, Int32 index, Int32 firstIndex, Double lengthLeft)
   at AvaloniaEdit.Text.TextLineImpl.Create(TextParagraphProperties paragraphProperties, Int32 firstIndex, Int32 paragraphLength, TextSource textSource)
   at AvaloniaEdit.Text.TextFormatter.FormatLine(TextSource textSource, Int32 firstCharIndex, Double paragraphWidth, TextParagraphProperties paragraphProperties)
   at AvaloniaEdit.Rendering.TextView.CalculateDefaultTextMetrics()
   at AvaloniaEdit.Rendering.TextView.get_DefaultLineHeight()
   at AvaloniaEdit.Rendering.TextView.OnDocumentChanged(TextDocument oldValue, TextDocument newValue)
   at AvaloniaEdit.Rendering.TextView.OnDocumentChanged(AvaloniaPropertyChangedEventArgs e)
   at System.Reactive.AnonymousObserver`1.OnNextCore(T value) in /_/Rx.NET/Source/src/System.Reactive/AnonymousObserver.cs:line 67
   at System.Reactive.ObserverBase`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/ObserverBase.cs:line 36
   at System.Reactive.Subjects.Subject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 147
   at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaPropertyChangedEventArgs`1 change) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 758
   at Avalonia.AvaloniaObject.Avalonia.PropertyStore.IValueSink.ValueChanged[T](AvaloniaPropertyChangedEventArgs`1 change) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 531
   at Avalonia.ValueStore.NotifyValueChanged[T](AvaloniaProperty`1 property, Optional`1 oldValue, BindingValue`1 newValue, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 367
   at Avalonia.ValueStore.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 123
   at Avalonia.AvaloniaObject.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 368
   at AvaloniaEdit.Rendering.TextView.set_Document(TextDocument value)
   at AvaloniaEdit.Editing.TextArea.OnDocumentChanged(TextDocument oldValue, TextDocument newValue)
   at AvaloniaEdit.Editing.TextArea.OnDocumentChanged(AvaloniaPropertyChangedEventArgs e)
   at System.Reactive.AnonymousObserver`1.OnNextCore(T value) in /_/Rx.NET/Source/src/System.Reactive/AnonymousObserver.cs:line 67
   at System.Reactive.ObserverBase`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/ObserverBase.cs:line 36
   at System.Reactive.Subjects.Subject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 147
   at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaPropertyChangedEventArgs`1 change) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 758
   at Avalonia.AvaloniaObject.Avalonia.PropertyStore.IValueSink.ValueChanged[T](AvaloniaPropertyChangedEventArgs`1 change) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 531
   at Avalonia.ValueStore.NotifyValueChanged[T](AvaloniaProperty`1 property, Optional`1 oldValue, BindingValue`1 newValue, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 367
   at Avalonia.ValueStore.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 123
   at Avalonia.AvaloniaObject.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 368
   at AvaloniaEdit.Editing.TextArea.set_Document(TextDocument value)
   at AvaloniaEdit.TextEditor.OnDocumentChanged(TextDocument oldValue, TextDocument newValue)
   at AvaloniaEdit.TextEditor.OnDocumentChanged(AvaloniaPropertyChangedEventArgs e)
   at System.Reactive.AnonymousObserver`1.OnNextCore(T value) in /_/Rx.NET/Source/src/System.Reactive/AnonymousObserver.cs:line 67
   at System.Reactive.ObserverBase`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/ObserverBase.cs:line 36
   at System.Reactive.Subjects.Subject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 147
   at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaPropertyChangedEventArgs`1 change) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 758
   at Avalonia.AvaloniaObject.Avalonia.PropertyStore.IValueSink.ValueChanged[T](AvaloniaPropertyChangedEventArgs`1 change) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 531
   at Avalonia.ValueStore.NotifyValueChanged[T](AvaloniaProperty`1 property, Optional`1 oldValue, BindingValue`1 newValue, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 367
   at Avalonia.ValueStore.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 123
   at Avalonia.AvaloniaObject.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 368
   at AvaloniaEdit.TextEditor..ctor(TextArea textArea, TextDocument document)
   at AvaloniaEdit.TextEditor..ctor(TextArea textArea)
   at AvaloniaEdit.TextEditor..ctor()
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.!XamlIlPopulate(IServiceProvider , DecompilerTextView ) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/TextView/DecompilerTextView.xaml:line 11
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.!XamlIlPopulateTrampoline(DecompilerTextView )
   at ICSharpCode.ILSpy.TextView.DecompilerTextView.InitializeComponent() in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/TextView/DecompilerTextView.xaml.cs:line 129
   at ICSharpCode.ILSpy.TextView.DecompilerTextView..ctor() in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/TextView/DecompilerTextView.xaml.cs:line 91
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Composition.RuntimeExportProviderFactory.RuntimeExportProvider.RuntimePartLifecycleTracker.CreateValue()
   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.Create()
   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveNext(PartLifecycleState nextState)
   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.MoveToState(PartLifecycleState requiredState)
   at Microsoft.VisualStudio.Composition.ExportProvider.PartLifecycleTracker.GetValueReadyToExpose()
   at Microsoft.VisualStudio.Composition.ExportProvider.<>c__DisplayClass55_0.<CreateExport>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Microsoft.VisualStudio.Composition.Export.get_Value()
   at Microsoft.VisualStudio.Composition.ExportProvider.<>c__DisplayClass71_1`2.<GetExports>b__1()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValue[T]()
   at ICSharpCode.ILSpy.MainWindow..ctor() in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/MainWindow.xaml.cs:line 133
   at ICSharpCode.ILSpy.App.OnFrameworkInitializationCompleted() in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy.Core/App.xaml.cs:line 133
   at Avalonia.Controls.AppBuilderBase`1.Setup() in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 313
   at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime) in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 180
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 148
   at ICSharpCode.ILSpy.Program.Main(String[] args) in /home/runner/work/AvaloniaILSpy/AvaloniaILSpy/ILSpy/Program.cs:line 22

My Machine

uname -a
Linux khamsin-legion 5.14.16-arch1-1 #1 SMP PREEMPT Tue, 02 Nov 2021 22:22:59 +0000 x86_64 GNU/Linux

@zryogi zryogi changed the title Can't open: System.InvalidOperationException: Default font family name can't be null or empty. Trhown whe executing Can't open in Linux: System.InvalidOperationException: Default font family name can't be null or empty. Trhown when executing Nov 14, 2021
@zryogi
Copy link
Author

zryogi commented Nov 15, 2021

It seems to be an unsolved issue at Avalonia: AvaloniaUI/Avalonia#4427

@brycehalling
Copy link

I had the same issue on arch as well. Installing ttf-dejavu fixed it for me.

@VinnieThePooh
Copy link

VinnieThePooh commented Sep 21, 2022

I had the same issue on arch as well. Installing ttf-dejavu fixed it for me.

Thanks bro. Fix works for me too (on arch as well).
Though it worked before, after uninstalling some orphanned packages (probably it was ttf-dejavu) in Pamac it became broken.

@passwa11
Copy link

This issue is also happening when the system language is set to Korean or Japanese and probably any other language with non-Latin characters as well. (tested on a fresh Ubuntu 20.10 VM x86_64)

I can fix this font loading issue by launching my app with a modified locale environment variable:

LC_ALL=C ./YourAvaloniaExecutable

From: AvaloniaUI/Avalonia#4427 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants