仅在发布版本上加载类型时,Xamarin UWP 发生故障

问题描述 投票:0回答:1

我尝试构建我的 Xamarin UWP 应用程序,但收到错误

Failure has occurred while loading a type only on release build

我不知道问题是什么,我在解决方案中有一个类似的 UWP 应用程序,这是工作。两者都有相同的 cpl 项目。

我还检查所有软件包版本以排除不匹配的情况,如下所述: 链接

应用程序中心中的堆栈跟踪并没有真正说明任何内容:

System.Runtime.InteropServices
McgMarshal.ThrowOnExternalCallFailed (Int32, RuntimeTypeHandle)
__Interop
ComCallHelpers.Call (__ComObject, RuntimeTypeHandle, Int32, Type__Impl.UnsafeType, 
Void*, Void*)
Windows.UI.Xaml.Controls.IFrame__Impl
Stubs.Navigate (__ComObject, Type, Object)
__Interop
Intrinsics.HasThisCall__31[TArg0] (Object, IntPtr, Object, TArg0)
ch.mycompany.myapp.windows!<BaseAddress>+0x3f1b790

System.Runtime.InteropServices
McgMarshal.ThrowOnExternalCallFailed (Int32, RuntimeTypeHandle)
__Interop
ComCallHelpers.Call (__ComObject, RuntimeTypeHandle, Int32, Type__Impl.UnsafeType, 
Void*, Void*)
Windows.UI.Xaml.Controls.IFrame__Impl
Stubs.Navigate (__ComObject, Type, Object)
MyCompany.App.ProjectUWP
App.OnLaunched (LaunchActivatedEventArgs) 
System.Collections.ObjectModel.ReadOnlyObservableCollection` 
1.System.Collections.Specialized
INotifyCollectionChanged.add_CollectionChanged (NotifyCollectionChangedEventHandler)
ch.mycompany.myapp.windows!<BaseAddress>+0x3f5af8e
System.Runtime.InteropServices
McgMarshal.ThrowOnExternalCallFailed (Int32, RuntimeTypeHandle)
__Interop
ComCallHelpers.Call (__ComObject, RuntimeTypeHandle, Int32)
__Interop
ForwardComStubs.Stub_15[TThis] (__ComObject, Int32)
Microsoft.AppCenter.Utils
ApplicationLifecycleHelper.<ctor>b__17_1 (Object, UnhandledErrorDetectedEventArgs)
System.Runtime.ExceptionServices
ExceptionDispatchInfo.Throw ()
Microsoft.AppCenter.Utils
ApplicationLifecycleHelper.<ctor>b__17_1 (Object, UnhandledErrorDetectedEventArgs)
System
EventHandler`1.Invoke (Object, TEventArgs)
__Interop
Intrinsics.HasThisCall__31[TArg0] (Object, IntPtr, Object, TArg0)
ch.mycompany.myapp.windows!<BaseAddress>+0x3f1b790

编辑:

经过几个小时的研究,我发现 Properties/Default.rd.xml 文件中缺少 2 个程序集。

<Assembly Name="Microsoft.Extensions.Options" Dynamic="Required All" />
<Assembly Name="Microsoft.Extensions.Logging" Dynamic="Required All" />

我怀疑这些是本地缓存的,并且在 Azure 上构建期间丢失了。但是,没有编译错误。

xamarin xamarin.uwp
1个回答
0
投票

根据您的编辑,作为答案:

Properties/Default.rd.xml 文件中缺少 2 个程序集导致了错误。

<Assembly Name="Microsoft.Extensions.Options" Dynamic="Required All" />
<Assembly Name="Microsoft.Extensions.Logging" Dynamic="Required All" />

在 Azure 上构建期间可能会丢失。

© www.soinside.com 2019 - 2024. All rights reserved.