无法在UWP中调试.NET Standard 2.0 DLL [英] Can't Debug .NET Standard 2.0 DLL in UWP

查看:71
本文介绍了无法在UWP中调试.NET Standard 2.0 DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个全新的Xamarin Forms解决方案,升级了所有NuGet,确保UWP版本针对内部版本16299,并确保.NET Standard项目针对2.0.我运行了该项目,并能够对.NET Standard 2.0 DLL进行调试.您可以在此处下载此文件,但我认为它没有任何用处: https://www.dropbox.com/s/jw13heu98yq2n6x/CleanXF.7z?dl=0 .

I created a fresh Xamarin Forms solution, upgraded all the NuGets, made sure that the UWP version was targeting build 16299, and made sure the .NET Standard project is targeting 2.0. I ran the project and was able to debug the .NET Standard 2.0 DLL fine. You can download this here but I don't think it will be of any use: https://www.dropbox.com/s/jw13heu98yq2n6x/CleanXF.7z?dl=0.

然后,我将这些项目拉到另一个解决方案中,添加了对其他项目的一些引用,并将一些Xamarin Forms页面等复制并粘贴到了新的干净项目中.然后,我可以编译并运行该项目,但是调试.NET Standard 2.0 Xamarin Forms项目根本不起作用.调试UWP代码确实可行,而较低级别的.NET Standard 2.0项目则可以调试.这只是一个不会调试的项目.我已经尝试过Git一次又一次地清理文件夹,以确保正在进行重建.我也尝试过从头开始创建项目,并将所有文件重新添加回去.同样,它可以编译并运行,但不能调试.

I then pulled these projects in to another solution, added some references to other projects, and copied and pasted some Xamarin Forms pages etc. in to the new clean projects. I could then compile and run the project, but debugging the .NET Standard 2.0 Xamarin Forms project does not work at all. Debugging the UWP code does work, and the lower level .NET Standard 2.0 projects do debug. It's only one project that won't debug. I have already tried Git cleaning the folders again and again to ensure that rebuilds are happening. I have also tried creating the project from scratch and adding all the files back in. Again, it compiles and runs, but doesn't debug.

我可以尝试使用哪些方法来进行调试?

推荐答案

事实证明,在UWP中调试.NET Standard 2.0程序集仍然存在问题.显然,.NET Standard 2.0项目中生成了一种新型的PDB.这与此错误有关,该错误具有一种解决方法:

It turns out that there are still issues with debugging .NET Standard 2.0 assemblies in UWP. Apparently there is a new type of PDB that is generated in .NET Standard 2.0 projects. This is related to this bug which has a workaround:

https://github.com/dotnet/sdk/issues/955

只需要编辑.NET Standard 2.0项目,就像这样:

It's just a matter of editing the .NET Standard 2.0 project like so:

<PropertyGroup>
    <DebugType>pdbonly</DebugType>
</PropertyGroup>

这将切换到老式PDB,并且会减慢调试速度,但是直到MSBuild等赶上来,这是从我所看到的问题中解决问题的唯一方法.

This switches to old school PDBs and will slow down debugging, but until MSBuild etc. catches up, it's the only way to solve the problem from what I can see.

Microsoft声称原始错误已在Visual Studio的最新版本中得到修复,但我尚未确认: https://github.com/Microsoft/UWPCommunityToolkit/issues/1951

某些人仍在遇到此问题-甚至是Microsoft的人,因此我目前都不知道其状态.

这篇关于无法在UWP中调试.NET Standard 2.0 DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆