Xamarin UWP 在发布版本中加载类型时发生故障。

huangapple go评论68阅读模式
英文:

Xamarin UWP Failure has occurred while loading a type only on release build

问题

I try to build my Xamarin UWP app but i get the error

在尝试构建我的Xamarin UWP应用程序时,我遇到了错误:

Failure has occurred while loading a type only on release build

仅在发布版本构建时发生了类型加载失败。

I do not know what is the problem, i have a similar UWP app in the Solution and this is work. Both has the same cpl project.

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

I check also all package versions to rule out mismatches as described here:
Link

我还检查了所有包的版本,以排除与此处描述的不匹配:

the stacktrace in the appcenter doesn't really say anything:

在AppCenter中的堆栈跟踪实际上没有提供任何信息:

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!&lt;BaseAddress&gt;+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.&lt;ctor&gt;b__17_1 (Object, UnhandledErrorDetectedEventArgs) System.Runtime.ExceptionServices ExceptionDispatchInfo.Throw () Microsoft.AppCenter.Utils ApplicationLifecycleHelper.&lt;ctor&gt;b__17_1 (Object, UnhandledErrorDetectedEventArgs) System EventHandler1.Invoke (Object, TEventArgs)
__Interop
Intrinsics.HasThisCall__31[TArg0] (Object, IntPtr, Object, TArg0)
ch.mycompany.myapp.windows!<BaseAddress>+0x3f1b790

EDIT:

After a few hours of research I found that 2 assemblys are missing in Properties/Default.rd.xml file.

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

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

I suspect these were cached locally and were missing during the build on Azure. However, there were no compilation errors.

我怀疑这些程序集在本地缓存,但在Azure上构建时丢失了。但是,没有编译错误。

英文:

I try to build my Xamarin UWP app but i get the error

Failure has occurred while loading a type only on release build

I do not know what is the problem, i have a similar UWP app in the Solution and this is work. Both has the same cpl project.

I check also all package versions to rule out mismatches as described here:
Link

the stacktrace in the appcenter doesn't really say anything:

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!&lt;BaseAddress&gt;+0x3f1b790

and

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!&lt;BaseAddress&gt;+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.&lt;ctor&gt;b__17_1 (Object, UnhandledErrorDetectedEventArgs)
System.Runtime.ExceptionServices
ExceptionDispatchInfo.Throw ()
Microsoft.AppCenter.Utils
ApplicationLifecycleHelper.&lt;ctor&gt;b__17_1 (Object, UnhandledErrorDetectedEventArgs)
System
EventHandler`1.Invoke (Object, TEventArgs)
__Interop
Intrinsics.HasThisCall__31[TArg0] (Object, IntPtr, Object, TArg0)
ch.mycompany.myapp.windows!&lt;BaseAddress&gt;+0x3f1b790

EDIT:

After a few hours of research I found that 2 assemblys are missing in Properties/Default.rd.xml file.

&lt;Assembly Name=&quot;Microsoft.Extensions.Options&quot; Dynamic=&quot;Required All&quot; /&gt;
&lt;Assembly Name=&quot;Microsoft.Extensions.Logging&quot; Dynamic=&quot;Required All&quot; /&gt;

I suspect these were cached locally and were missing during the build on Azure. However, there were no compilation errors.

答案1

得分: 0

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

&lt;Assembly Name=&quot;Microsoft.Extensions.Options&quot; Dynamic=&quot;Required All&quot; /&gt;
&lt;Assembly Name=&quot;Microsoft.Extensions.Logging&quot; Dynamic=&quot;Required All&quot; /&gt;

可能在Azure上构建时丢失。

英文:

Accoring to your Edit, as an answer:

2 assemblys missing in Properties/Default.rd.xml file caused the error.

&lt;Assembly Name=&quot;Microsoft.Extensions.Options&quot; Dynamic=&quot;Required All&quot; /&gt;
&lt;Assembly Name=&quot;Microsoft.Extensions.Logging&quot; Dynamic=&quot;Required All&quot; /&gt;

It may miss during the build on Azure.

huangapple
  • 本文由 发表于 2023年8月4日 21:59:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76836636.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定