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!<BaseAddress>+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!<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
EDIT:
After a few hours of research I found that 2 assemblys are missing in Properties/Default.rd.xml file.
<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.
Accoring to your Edit, as an answer:
2 assemblys missing in Properties/Default.rd.xml file caused the error.
It may miss during the build on Azure.