Eto: La extracción de dependencias rompió la carga de XAML en plataformas que no son de Windows

Creado en 24 oct. 2020  ·  4Comentarios  ·  Fuente: picoe/Eto

Sin cambiar nada en mi código, después de actualizar a la última compilación "nocturna", la aplicación se bloquea en Linux con la excepción:

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 

Trabajando con la versión 2.5.7-ci-20201007.292499425
Roto con la versión 2.5.7-ci-20201021.320816878

Pasos para reproducir el problema

Mi proyecto (.NET framework) crea solo un ejecutable para todas las plataformas y hace referencia tanto a Eto.Wpf.dll como a Eto.Gtk.dll . No se utiliza ningún código de detección de plataforma personalizado. Los formularios se crean mediante el lector XAML.

Pensamientos

Supongo que el compromiso https://github.com/picoe/Eto/commit/2231f4c2a49066a8381a46c6eb64a31d1e32e784 introdujo este problema. Desde el seguimiento de la pila, parece que no la carga de la plataforma real es defectuosa, sino que Portable.Xaml intenta cargar algunos ensamblajes presentes en la carpeta de la aplicación (?). A partir de https://github.com/picoe/Eto/commit/2231f4c2a49066a8381a46c6eb64a31d1e32e784 , hay más archivos con una dependencia explícita a Wpf (que obviamente no está disponible ni es necesario en Linux).

Eliminar todos los archivos Xceed.*.dll del directorio de compilación elimina el bloqueo, pero obviamente esto no es una solución ya que esas dependencias son necesarias en Windows ...

Especificaciones

  • Versión: versión actual de myget 2.5.7-ci-20201021.320816878
  • Plataforma (s): Gtk (solo cuando las dependencias de Wpf están presentes)
  • Sistema (s) operativo (s): Fedora 32
bug

Comentario más útil

De hecho, solucionó el problema :-) Simplemente escupe advertencias mono ( Can't find custom attr constructor image: ... ), pero no se pueden desactivar con el código de usuario (hasta donde yo sé).

¡Gracias!

Todos 4 comentarios

Hola @ManuelHu ,

Gracias por informar del problema. Es posible que tengamos que arreglar esto en el lado Portable.Xaml poniendo un try / catch in al escanear ensambles en busca de atributos.

Sí, eso debería evitarlo ...: +1:

Portable.Xaml 0.26.0 _debería_ solucionar este problema. ¡Por favor inténtalo!

De hecho, solucionó el problema :-) Simplemente escupe advertencias mono ( Can't find custom attr constructor image: ... ), pero no se pueden desactivar con el código de usuario (hasta donde yo sé).

¡Gracias!

¿Fue útil esta página
0 / 5 - 0 calificaciones