1

我们有一个 Xamarin Forms 项目,我们在其 MainActivity 中动态连接类库。在连接之前,这个库会从服务器导入到android 设备上System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal)的文件夹中。/data/data/com.companyname.projectname/files接下来,使用反射,我们创建一个 IApplicationController 类型的对象:

Assembly asm = Assembly.LoadFrom (localLibFilePath);
Type [] types = asm.GetTypes ();
var type = types.SingleOrDefault (t => t.GetInterface (nameof (IApplicationController))! = null);
var App = Activator.CreateInstance (type) as IApplicationController;

然后我们使用对象 (Xamarin.Forms.Application) 应用程序从 dll 启动应用程序:

LoadApplication ((Xamarin.Forms.Application) App);

在插件库的 App : Application 类中,设置断点,开始调试。部署到设备后,应用程序停止在该行var App = Activator.CreateInstance (type) as IApplicationController;,然后不进入库。在这种情况下,这一行的指针采用如下形式:

xamarin dll 调试问题截图

该库使用 .pdb 文件加载到设备上。

可插入库项目与 Droid 应用程序位于同一解决方案中。

'App.xaml.cs: 25,1' 处的 Resolved pending breakpoint to void AppBase.App..ctor () [0x00008] 行出现在输出窗口中。

非常感谢您的帮助!

4

0 回答 0