英文:
How can I determine which thread is running native code vs managed code in visual studio community?
问题
在我在这个函数内设置断点时,如何尝试调试我的托管代码?
public class MainActivity : AppCompatActivity, NavigationView.IOnNavigationItemSelectedListener
{
public bool OnNavigationItemSelected(IMenuItem menuItem)
{
int id = menuItem.ItemId; // 在此设置断点
if (id == Resource.Id.nav_3DESK)
{
string location = "3 Desk";
}
}
}
我尝试过
- 在调试选项中启用仅调试我的代码
- 创建一个子函数放在这个函数内并在其中调试
- 回滚到先前版本的Visual Studio
英文:
How can I go about trying to debug my managed code within the function that pops up that error when I place a breakpoint within it?
public class MainActivity : AppCompatActivity, NavigationView.IOnNavigationItemSelectedListener
{
public bool OnNavigationItemSelected(IMenuItem menuItem)
{
int id = menuItem.ItemId; //breakpoint here
if (id == Resource.Id.nav_3DESK)
{
string location = "3 Desk";
}
}
}
I've tried
- enable just my code within the debug options
- creating a sub function to place within this function and debug within
- rolling back to a previous version of visual studio
答案1
得分: 0
我已经克隆了你的项目并进行了测试。起初,我遇到了与你相同的问题。然后,我检查了你项目中的NuGet包版本,并发现它们是旧版本。
在我更新了NuGet包的版本之后,断点将会被触发:
将Xamarin.AndroidX.AppCompat从1.2.0.5升级到1.6.1.2
将Xamarin.Essentials从1.6.1升级到1.7.7
将Xamarin.Google.Android.Material从1.0.0.1升级到1.9.0.1
结果图像:
英文:
I have cloned your project and tested it. I met the same problem as yours at first. And then I checked the nuget packages' version in your project and found they are old version.
And the break point will be hit after I updated the nuget packages' versions:
Update Xamarin.AndroidX.AppCompat from 1.2.0.5 to 1.6.1.2
Update Xamarin.Essentials from 1.6.1 to 1.7.7
Update Xamarin.Google.Android.Material from 1.0.0.1 to 1.9.0.1
The result image:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论