xamarin 发布配置时部署导致异常“找不到MvvmCross.Core.MvxSettings类型的构造函数”

jslywgbw  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(31)

我使用MvvmCross星星大战示例(https://github.com/MvvmCross/MvvmCross-Samples/tree/master/StarWarsSample)作为开始的项目,根据我的一些需求进行了调整,并试图将其部署在Google Pixel 4上。
我只有核心和droid项目,没有iOS。
在调试模式下启动应用程序工作正常。
启动已部署的应用程序时发生错误,请参阅:visual studio exception

LogCat Stacktrace:

06-09 21:33:24.491:I/MonoDroid(24322):未处理异常:06-09 21:33:24.495:I/MonoDroid(24322):System.ArgumentNullException:MvxWeakEventSubscription中缺少源事件信息06-09 21:33:24.495:I/MonoDroid(24322):参数名称:sourceEventInfo 06-09 21:33:24.495:I/MonoDroid(24322):在MvvmCross.WeakSubscription.MvxWeakEventSubscription 2[TSource,TEventArgs]..ctor (Android.Views.View source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler 1[TEventArgs] targetEventList)[0x 0001 d]中:0 06-09 21:33:24.495:I/MonoDroid(24322):在MvvmCross.WeakSubscription.MvxWeakEventSubscription 2[TSource,TEventArgs]..ctor (Android.Views.View source, System.String sourceEventName, System.EventHandler 1[TEventArgs] targetEventList)[0x 00012]中:0 06-09 21:33:24.495:我/MonoDroid(24322):在MvvmCross.Platforms.Android.WeakSubscription.MvxAndroidTargetEventSubscription 2[TSource,TEventArgs]..ctor (Android.Views.View source, System.String sourceEventName, System.EventHandler 1[TEventArgs] targetEventSubscription)[0x 00000] in:0 06-09 21:33:24.495:我/MonoDroid(24322):在MvvmCross.Platforms.Android.WeakSubscription.MvxAndroidWeakSubscriptionExtensions.WeakSubscribe[TSource,TEventArgs](TSource source,System.String eventName,System. EventName `1[TEventArgs] eventName)[0x00000] in:0 06-09 21:33:24.495:I/MonoDroid(24322):在MvvmCross.Droid.Support.V7.MixclerView.MvxclerViewHolder.OnAttachedToWindow()[0x 00074]中,时间<6dcdb499fdcb47abb57d7957137b06a2>:0 06-09 21:33:24.496:I/MonoDroid(24322):在MvvmCross.Droid.Support.V7.MvxClerView.MvxClerAdapter.OnViewAttachedToWindow(Java.Lang.Object保持器)[0x 0000 e],时间<6dcdb499fdcb47abb57d7957137b06a2>:0 06-09 21:33:24.496:I/MonoDroid(24322):在AndroidX. InclerView.Widget. InclerView +Adapter.n_OnViewAttachedToWindow_Landroidx_InclerView_Widget_InclerView_ViewHolder_(System.IntPtr jnienv,System. IntPtr native__this,System. IntPtr native_holder)[0x000f]在:0 06-09 21:33:24.496:I/MonoDroid(24322):at(wrapper dynamic-method)Android.Runtime.DynamicMethodNameCounter.55(intptr,intptr,intptr)

**(2020年6月10日)编辑1:**将标题从“无法找到MvvmCross.Core.MvxSettings#类型的构造函数”更改为“在发布配置时部署导致异常“无法找到MvvmCross.Core.MvxSettings类型的构造函数”“
**(2020年6月10日)编辑2:**已将以下片段插入LinkerPleaseInclude.cs

public void Include(MvxSettings mvxSettings)
{
    mvxSettings = new MvxSettings();
}

public void Include(MvxStringToTypeParser mvxStringToTypeParser)
{
    mvxStringToTypeParser = new MvxStringToTypeParser();
}

字符串
现在似乎在MyApp.Droid.Setup. SetupApp()之后但在MyApp.Core.App初始化之前或之中出现了一个错误。
由于没有在那里,它似乎必须有另一个原因冻结在这一点上。

ee7vknir

ee7vknir1#

就像在评论中讨论的那样,这是一个修剪问题。我们已经从.NET 6升级到.NET 8,在.NET 7/8中删除了复制的修剪模式。
在android.csproj中将 copyused 替换为 partial 对我们来说很有效。

<TrimMode>partial</TrimMode>

字符串

相关问题