MAUI Android平台ViewHandler Context为空异常处理及相关问题咨询
ViewHandler - InvalidOperationException : Context cannot be null here
异常触发时机 : 导航至包含自定义控件的页面时
Platform : AndroidSDK : 8.x Preview Version异常发生位置 : ViewHandlerOfT.Android - 第12行
// ViewHandlerOfT.Android - Line12 public partial class ViewHandler<TVirtualView, TPlatformView> : IPlatformViewHandler { ... public Context Context => MauiContext?.Context ?? throw new InvalidOperationException($"Context cannot be null here"); ... }
咨询背景 : 已查阅Stack Overflow和MAUI相关问题,但未找到有效解答。
问题
- 若有不理解之处,请
告知所需补充信息。 - 自定义控件
未注册Handler,是否需要注册Handler? - 如何进行
(Context)空值检查? - 请告知
Context何时会为空
更新时间:2023.11.15
内容的提问来源于stack exchange,提问作者K. K
相关产品推荐
相关产品推荐

