首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >发布模式下的Xamarin.UWP运行时错误

发布模式下的Xamarin.UWP运行时错误
EN

Stack Overflow用户
提问于 2019-03-05 09:21:23
回答 2查看 608关注 0票数 2

在发布模式下运行我的Xamarin.Forms.UWP应用程序时,我得到了一个错误。

代码语言:javascript
复制
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中自动生成的代码部分中。

代码语言:javascript
复制
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);
            }

在这条线内:

代码语言:javascript
复制
rootFrame.Navigate(typeof(MainPage), e.Arguments);

只有当我在发布模式下运行应用程序时,才会发生这种情况,如果在调试中运行,就不会发生错误。

EN

回答 2

Stack Overflow用户

发布于 2019-03-05 16:21:19

在发布模式下,您必须执行自己加载程序集

代码语言:javascript
复制
// 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);

因此,添加使用1行assembliesToInclude.Add(typeof (ClassInOtherAssembly).GetTypeInfo().Assembly);的每一个第三方类

票数 0
EN

Stack Overflow用户

发布于 2019-03-06 08:51:35

我通过在我的UWP项目中取消检查“用.NET本地工具链编译”来修正它。但我不确定这是否只是暂时的解决办法

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54999336

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档