How can I determine which thread is running native code vs managed code in visual studio community?

huangapple go评论66阅读模式
英文:

How can I determine which thread is running native code vs managed code in visual studio community?

问题

如果我收到这个错误 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
英文:

If I'm receiving this How can I determine which thread is running native code vs managed code in visual studio community?

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

结果图像:

How can I determine which thread is running native code vs managed code in visual studio community?

英文:

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:

How can I determine which thread is running native code vs managed code in visual studio community?

huangapple
  • 本文由 发表于 2023年7月4日 22:33:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76613675.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定