Xamarin.UWP Ошибка времени выполнения в режиме выпуска - PullRequest
0 голосов
/ 05 марта 2019

Я получаю сообщение об ошибке при запуске моего приложения Xamarin.Forms.UWP в режиме выпуска.

onecore\com\combase\inc\comcataloghelpers.hpp(64)\combase.dll!00007FFD5E991DAA: (caller: 00007FFD5E990205) ReturnHr(1) tid(6adc) 80040154 Klasse nicht registriert
onecore\com\combase\inc\comcataloghelpers.hpp(64)\combase.dll!00007FFD5E991DAA: (caller: 00007FFD5E990205) ReturnHr(2) tid(2ac4) 80040154 Klasse nicht registriert
onecore\com\combase\inc\comcataloghelpers.hpp(64)\combase.dll!00007FFD5E991DAA: (caller: 00007FFD5E990205) ReturnHr(3) tid(39ec) 80040154 Klasse nicht registriert
onecore\com\combase\inc\comcataloghelpers.hpp(64)\combase.dll!00007FFD5E991DAA: (caller: 00007FFD5E990205) ReturnHr(4) tid(27a4) 80040154 Klasse nicht registriert
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
Exception thrown: 'System.PlatformNotSupportedException' in System.Private.CoreLib.dll
Exception thrown: 'System.PlatformNotSupportedException' in System.Private.Interop.dll
Unhandled exception at 0x00007FFD43DB83B9 (Windows.UI.Xaml.dll) in Lama.Forms.UWP.exe: 0xC000027B: Anwendungsinterne Ausnahme (parameters: 0x000001FF87EB6FA0, 0x0000000000000002).

Это происходит внутри автоматически сгенерированного фрагмента кода внутри App.xaml.cs

protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                Xamarin.Forms.Forms.Init(e);

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }

Внутри этой строки:

rootFrame.Navigate(typeof(MainPage), e.Arguments);

Это происходит, только если я запускаю приложение в режиме Release , если я выполняю в Debug ошибки не происходит.

Ответы [ 2 ]

0 голосов
/ 06 марта 2019

Я исправил это, сняв флажок «Компилировать с помощью .NET Native tool chain» внутри моего проекта UWP.Но я не уверен, что это только временное исправление

0 голосов
/ 05 марта 2019

В режиме выпуска у вас есть загрузка сборок самостоятельно :

// You'll need to add using System.Reflection;

List<Assembly> assembliesToInclude = new List<Assembly>();

// Now, add in all the assemblies your app uses
assembliesToInclude.Add(typeof (ClassInOtherAssembly).GetTypeInfo().Assembly);

// Also do this for all your other 3rd party libraries
Xamarin.Forms.Forms.Init(e, assembliesToInclude);
// replaces Xamarin.Forms.Forms.Init(e);

Поэтому добавьте каждый используемый вами класс третьей стороны в одну строку assembliesToInclude.Add(typeof (ClassInOtherAssembly).GetTypeInfo().Assembly);

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...