打包的 Xamarin Forms UWP 应用程序在启动时崩溃 - 在 VS 调试和发布模式下工作

发布于 2025-01-09 03:21:12 字数 1741 浏览 6 评论 0原文

我一直在重写一个应用程序并遇到(再次:-( )它在调试和发布模式下工作,但打包的应用程序在启动时崩溃。即永远不会进入应用程序的主屏幕。我遇到了这种情况第一次,但最终从谷歌搜索结果中解决了这个问题,但这一次我已经走进了死胡同,不知道我还能做什么,我之前尝试过并有效,但这次没有效果......

  1. 删除了所有.vs。文件夹,干净,勾选
  2. “使用.net本机工具链进行编译”(事实上,我发现默认情况下已经勾选了它。所以我尝试将其关闭,然后打包失败,并出现一些关于清单现在不匹配的错误)
  3. 3我可能能够适应,但还不知道如何适应,上次我在应用程序中添加了 ZXing,这最终成为了问题,通过添加“
List<Assembly> assembliesToInclude=new List<Assembly>();
assembliesToInclude.Add(typeof(ZXing.Net.Mobile.Forms.WindowsUniversal.ZXingScannerViewRenderer).GetTypeInfo().Assembly);
Xamarin.Forms.Forms.Init(e,assembliesToInclude);

我在新应用程序中还没有 ZXing,但我有一个包” 来解决。我补充说我之前有的是CsvHelper,所以我怀疑这可能是原因,请注意,我之前版本的打包应用程序在添加之前正在运行,因此这增加了怀疑。

但我找不到遇到此问题的人,所以我不确定如何找到需要添加哪些程序集? (当ZXing发生这种情况时,我只是复制了别人所说的。他们实际上列出了一大堆ZXing程序集,但我最终能够通过添加所有程序集然后一次删除一个程序集来将其范围缩小到一个时间)

那么...

  1. 关于如何查找可能需要添加的 CsvHelper 程序集有什么想法吗?即我如何找到它首先包含哪些程序集?
  2. 还有其他建议吗?这是我从 Windows 事件查看器收到的错误 - 不确定这些数字是否确实告诉了我任何有用的信息,如果是的话,是哪些数字以及如何告诉我?
Faulting application name: Myappname.UWP.exe, version: 1.0.0.0, time stamp: 0x62158bed
Faulting module name: KERNELBASE.dll, version: 10.0.19041.1503, time stamp: 0xb2acaea9
Exception code: 0xc000027b
Fault offset: 0x000000000010b382
Faulting process ID: 0x5660
Faulting application start time: 0x01d82857d5105201
Faulting application path: C:\Program Files\WindowsApps\00bf2865-c554-4952-9142-753983df67d5_0.3.0.0_x64__b71kk8c7kdz5g\Myappname.UWP.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report ID: fb10dc41-a7f1-4d74-ad8e-befa62556dcc
Faulting package full name: 00bf2865-c554-4952-9142-753983df67d5_0.3.0.0_x64__b71kk8c7kdz5g
Faulting package-relative application ID: App

谢谢, 唐纳德.

I've been re-writing an app and run into (again :-( ) that it's working in both Debug and Release modes, but the packaged app crashes on launch. i.e. never even gets to the app's home screen. I had this happen first time around, but eventually solved it from Googled results, however this time I've reached a dead-end and not sure what else I can do. Things I tried previously and worked but no effect this time...

  1. deleted all .vs folders, clean, build.
  2. tick "compile with .net native tool chain" (in fact that is now ticked by default I found. So I tried turning it off, and the packaging then failed with some error about the manifest not matching something now)
  3. 3 I may be able to adapt, but not sure how yet. Last time I had ZXing in the app, and that ended up being the problem. It was solved by adding
List<Assembly> assembliesToInclude=new List<Assembly>();
assembliesToInclude.Add(typeof(ZXing.Net.Mobile.Forms.WindowsUniversal.ZXingScannerViewRenderer).GetTypeInfo().Assembly);
Xamarin.Forms.Forms.Init(e,assembliesToInclude);

I don't have ZXing in the new app yet, BUT one package I've added that I had before is CsvHelper, so I suspect that may be the cause. Note that my previous version of the packaged app was working before I added it, so that adds to the suspicion.

But I can't find anyone who has run into this, so I'm not sure how I can find what assemblies would need to be added? (when it happened with ZXing, I just copied what someone else had said. They in fact had listed a whle bunch of ZXing assemblies, but I ended up being able to narrow it down to one by adding all and then taking away one at a time)

So...

  1. any ideas on how to find what CsvHelper assemblies might need to be added? i.e. how do I even find what assemblies it has in it to begin with?
  2. any other suggestions? This is the error I'm getting from the Windows Event Viewer - not sure if any of these numbers actually tell me anything useful, and if so which ones and how?
Faulting application name: Myappname.UWP.exe, version: 1.0.0.0, time stamp: 0x62158bed
Faulting module name: KERNELBASE.dll, version: 10.0.19041.1503, time stamp: 0xb2acaea9
Exception code: 0xc000027b
Fault offset: 0x000000000010b382
Faulting process ID: 0x5660
Faulting application start time: 0x01d82857d5105201
Faulting application path: C:\Program Files\WindowsApps\00bf2865-c554-4952-9142-753983df67d5_0.3.0.0_x64__b71kk8c7kdz5g\Myappname.UWP.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report ID: fb10dc41-a7f1-4d74-ad8e-befa62556dcc
Faulting package full name: 00bf2865-c554-4952-9142-753983df67d5_0.3.0.0_x64__b71kk8c7kdz5g
Faulting package-relative application ID: App

Thanks,
Donald.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文