Mon application Xamarin.Forms se bloque lorsque j'ouvre une page spécifique. Le crash est reproductible, mais uniquement en mode Release. Lorsque je crée et exécute l'application en mode débogage, la même page s'ouvre correctement. Avec un peu d'effort, j'ai réussi à attraper l'exception et afficher la trace de la pile dans une fenêtre de message avant la fermeture de l'application. L'erreur de base semble être un FileNotFoundException
pour l'assemblage System.Runtime
quelque part dans le XamlParser
du XamlLoader
qui fonctionne lorsque ma page appelle la méthode InitializeComponent
:L'application Xamarin.Forms se bloque avec FileNotFoundException dans InitializeComponent
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime' or one of its dependencies
File name: 'System.Runtime'
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity)
at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef)
at (wrapper remoting-invoke-with-check) System.AppDomain:Load (System.Reflection.AssemblyName)
at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef)
at Xamarin.Forms.Xaml.XamlParser.GetElementType (Xamarin.Forms.Xaml.XmlType xmlType, IXmlLineInfo xmlInfo, System.Reflection.Assembly currentAssembly, Xamarin.Forms.Xaml.XamlParseException& exception)
at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode)
at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode)
at Xamarin.Forms.Xaml.RootNode.Accept (IXamlNodeVisitor visitor, INode parentNode)
at Xamarin.Forms.Xaml.XamlLoader.Visit (Xamarin.Forms.Xaml.RootNode rootnode, Xamarin.Forms.Xaml.HydratationContext visitorContext)
at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.String xaml)
at Xamarin.Forms.Xaml.XamlLoader.Load (System.Object view, System.Type callingType)
at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TXaml] (Xamarin.Forms.Xaml.TXaml view, System.Type callingType)
at MyApp.MyNamespace.Pages.MyPage.InitializeComponent()
at MyApp.MyNamespace.Pages.MyPage..ctor()