Eto: Извлечение зависимостей нарушило загрузку XAML на платформах, отличных от Windows

Созданный на 24 окт. 2020  ·  4Комментарии  ·  Источник: picoe/Eto

Ничего не меняя в моем коде, после обновления до последней «ночной» сборки приложение вылетает в Linux за исключением:

System.IO.FileNotFoundException: Could not load file or assembly 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
File name: 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
  at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal(System.Reflection.ICustomAttributeProvider,System.Type,bool)
  at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00013] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/corlib/System/MonoCustomAttrs.cs:128 
  at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00037] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/corlib/System/MonoCustomAttrs.cs:163 
  at System.Reflection.RuntimeAssembly.GetCustomAttributes (System.Type attributeType, System.Boolean inherit) [0x00000] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/corlib/System.Reflection/RuntimeAssembly.cs:520 
  at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x0005c] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/referencesource/mscorlib/system/attribute.cs:866 
  at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/referencesource/mscorlib/system/attribute.cs:851 
  at System.Reflection.CustomAttributeExtensions.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/referencesource/mscorlib/system/reflection/CustomAttributeExtensions.cs:92 
  at Portable.Xaml.XamlSchemaContext.FillCompatibilities (System.Reflection.Assembly ass) [0x00000] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.XamlSchemaContext.TryGetCompatibleXamlNamespace (System.String xamlNamespace, System.String& compatibleNamespace) [0x00036] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.CompatibleXmlReader.GetMapped (System.String ns) [0x00012] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.CompatibleXmlReader.get_NamespaceURI () [0x0000c] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.CompatibleXmlReader.ProcessStartElement () [0x00000] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.CompatibleXmlReader.Read () [0x0002f] in <16c90363778e4b50b411e4917b044d09>:0 
  at System.Xml.XmlReader.MoveToContent () [0x0003a] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlReader.cs:728 
  at Portable.Xaml.XamlXmlParser+<Parse>d__13.MoveNext () [0x0002e] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.XamlXmlReader.Read () [0x00031] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.XamlServices.Transform (Portable.Xaml.XamlReader xamlReader, Portable.Xaml.XamlWriter xamlWriter, System.Boolean closeWriter) [0x00024] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.XamlServices.Transform (Portable.Xaml.XamlReader xamlReader, Portable.Xaml.XamlWriter xamlWriter) [0x00000] in <16c90363778e4b50b411e4917b044d09>:0 
  at Eto.Serialization.Xaml.XamlReader.Load[T] (Portable.Xaml.XamlXmlReader reader, T instance) [0x0003c] in <9017e3c4c6ad4d44933e97fb9cb6efcd>:0 
  at Eto.Serialization.Xaml.XamlReader.Load[T] (System.IO.Stream stream, T instance) [0x0002e] in <9017e3c4c6ad4d44933e97fb9cb6efcd>:0 
  at Eto.Serialization.Xaml.XamlReader.Load[T] (T instance) [0x00029] in <9017e3c4c6ad4d44933e97fb9cb6efcd>:0 
  at FPLedit.MainForm..ctor (FPLedit.LastFileHandler lfh, FPLedit.CrashReporting.CrashReporter crashReporter, FPLedit.Bootstrapper bootstrapper) [0x00008] in fpledit-src/FPLedit/MainForm.xeto.cs:57 
  at FPLedit.Program.Main (System.String[] args) [0x0017f] in fpledit-src/FPLedit/Program.cs:76 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
File name: 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
  at (wrapper managed-to-native) System.MonoCustomAttrs.GetCustomAttributesInternal(System.Reflection.ICustomAttributeProvider,System.Type,bool)
  at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00013] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/corlib/System/MonoCustomAttrs.cs:128 
  at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00037] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/corlib/System/MonoCustomAttrs.cs:163 
  at System.Reflection.RuntimeAssembly.GetCustomAttributes (System.Type attributeType, System.Boolean inherit) [0x00000] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/corlib/System.Reflection/RuntimeAssembly.cs:520 
  at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x0005c] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/referencesource/mscorlib/system/attribute.cs:866 
  at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/referencesource/mscorlib/system/attribute.cs:851 
  at System.Reflection.CustomAttributeExtensions.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType) [0x00000] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/referencesource/mscorlib/system/reflection/CustomAttributeExtensions.cs:92 
  at Portable.Xaml.XamlSchemaContext.FillCompatibilities (System.Reflection.Assembly ass) [0x00000] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.XamlSchemaContext.TryGetCompatibleXamlNamespace (System.String xamlNamespace, System.String& compatibleNamespace) [0x00036] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.CompatibleXmlReader.GetMapped (System.String ns) [0x00012] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.CompatibleXmlReader.get_NamespaceURI () [0x0000c] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.CompatibleXmlReader.ProcessStartElement () [0x00000] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.CompatibleXmlReader.Read () [0x0002f] in <16c90363778e4b50b411e4917b044d09>:0 
  at System.Xml.XmlReader.MoveToContent () [0x0003a] in /builddir/build/BUILD/mono-6.12.0.102/mcs/class/referencesource/System.Xml/System/Xml/Core/XmlReader.cs:728 
  at Portable.Xaml.XamlXmlParser+<Parse>d__13.MoveNext () [0x0002e] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.XamlXmlReader.Read () [0x00031] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.XamlServices.Transform (Portable.Xaml.XamlReader xamlReader, Portable.Xaml.XamlWriter xamlWriter, System.Boolean closeWriter) [0x00024] in <16c90363778e4b50b411e4917b044d09>:0 
  at Portable.Xaml.XamlServices.Transform (Portable.Xaml.XamlReader xamlReader, Portable.Xaml.XamlWriter xamlWriter) [0x00000] in <16c90363778e4b50b411e4917b044d09>:0 
  at Eto.Serialization.Xaml.XamlReader.Load[T] (Portable.Xaml.XamlXmlReader reader, T instance) [0x0003c] in <9017e3c4c6ad4d44933e97fb9cb6efcd>:0 
  at Eto.Serialization.Xaml.XamlReader.Load[T] (System.IO.Stream stream, T instance) [0x0002e] in <9017e3c4c6ad4d44933e97fb9cb6efcd>:0 
  at Eto.Serialization.Xaml.XamlReader.Load[T] (T instance) [0x00029] in <9017e3c4c6ad4d44933e97fb9cb6efcd>:0 
  at FPLedit.MainForm..ctor (FPLedit.LastFileHandler lfh, FPLedit.CrashReporting.CrashReporter crashReporter, FPLedit.Bootstrapper bootstrapper) [0x00008] in fpledit-src/FPLedit/MainForm.xeto.cs:57 
  at FPLedit.Program.Main (System.String[] args) [0x0017f] in fpledit-src/FPLedit/Program.cs:76 

Работа с версией 2.5.7-ci-20201007.292499425
Не работает с версией 2.5.7-ci-20201021.320816878

Шаги по воспроизведению проблемы

Мой проект (платформа .NET) создает только один исполняемый файл для всех платформ и ссылается как на Eto.Wpf.dll так и на Eto.Gtk.dll . Код определения специальной платформы не используется. Формы создаются с помощью средства чтения XAML.

Мысли

Я полагаю, что коммит https://github.com/picoe/Eto/commit/2231f4c2a49066a8381a46c6eb64a31d1e32e784 вызвал эту проблему. Из трассировки стека похоже, что не фактическая загрузка платформы является ошибочной, а как будто Portable.Xaml пытается загрузить некоторые сборки, присутствующие в папке приложения (?). Начиная с https://github.com/picoe/Eto/commit/2231f4c2a49066a8381a46c6eb64a31d1e32e784 , присутствует больше файлов с явной зависимостью от Wpf (что, очевидно, недоступно и не требуется в Linux).

Удаление всех файлов Xceed.*.dll из каталога сборки устраняет сбой, но это, очевидно, не решение, поскольку эти зависимости необходимы в Windows ...

Характеристики

  • Версия: текущая версия myget 2.5.7-ci-20201021.320816878
  • Платформы: Gtk (только при наличии зависимостей Wpf)
  • Операционная система (ы): Fedora 32

Самый полезный комментарий

Это действительно устранило проблему :-) Он просто выплевывает моно-предупреждения ( Can't find custom attr constructor image: ... ), но их нельзя отключить пользовательским кодом (насколько я знаю).

Спасибо!

Все 4 Комментарий

Привет @ManuelHu ,

Благодарим за сообщение о проблеме! Возможно, нам придется исправить это на стороне Portable.Xaml, добавив try / catch при сканировании сборок на предмет атрибутов.

Да, это должно предотвратить это ...: +1:

Portable.Xaml 0.26.0 _ должен_ исправить эту проблему. Пожалуйста, попробуйте!

Это действительно устранило проблему :-) Он просто выплевывает моно-предупреждения ( Can't find custom attr constructor image: ... ), но их нельзя отключить пользовательским кодом (насколько я знаю).

Спасибо!

Была ли эта страница полезной?
0 / 5 - 0 рейтинги