Can't have multiple instances.
barteke22 opened this issue · 1 comments
barteke22 commented
It appears that it's not possible to have multiple instances of a .Net Framework (4.8) WPF app containing FontAwesome6 icons.
Your FontAwesome5 implementation worked just fine (and still does), so I'm wondering if some extra steps are required to achieve the same result, or if it's simply not intended to support multiple instances at all?
To reproduce you simply have to make a new .Net Framework WPF app, place any font awesome icon in the xaml and launch the app.
If you try to launch another instance of this app (execute the .exe again), it will crash instantly, giving the following exception:
Exception:
'Set property 'FontAwesome6.Fonts.FontAwesome.Icon' threw an exception.' Line number '13' and line position '18'.
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at WpfApp2.MainWindow.InitializeComponent() in C:\...\WpfApp2\MainWindow.xaml:line 1
Inner 1:
The type initializer for 'FontAwesome6.Fonts.FontAwesomeFonts' threw an exception.
at FontAwesome6.Fonts.FontAwesomeFonts.GetFontFamily(EFontAwesomeStyle style)
at FontAwesome6.Fonts.FontAwesome.OnIconPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.Controls.TextBlock.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.Baml2006.WpfMemberInvoker.SetValue(Object instance, Object value)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(XamlMember member, Object obj, Object value)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
Inner2:
Access to the path 'C:\Users\...\AppData\Local\Temp\fa-solid-900.ttf' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at FontAwesome6.Fonts.FontAwesomeFonts.WriteResourceToFile(ResourceManager resManager, String resourceName, String fileName)
at FontAwesome6.Fonts.FontAwesomeFonts.SaveFontFilesToDirectory(String path)
at FontAwesome6.Fonts.FontAwesomeFonts..cctor()
MartinTopfstedt commented
Hi, the issue should be fixed in version 2.3.0.