Can't find System.Threading 4.0.10 on Raspberry Pi on Windows 10 Iot

独自空忆成欢 提交于 2019-12-25 07:16:00

问题


I'm creating a new simple UWP Blank application from the IoT template, and just adding a simple code to it:

        var xyz = new System.Threading.ManualResetEvent(false);
        xyz.WaitOne(1000);

It works fine when I run this in x86 mode on my PC, and it worked fine on Raspberry Pi running Windows 10 IoT before I upgraded my PC to .NET Core RC2. Now I'm getting an error saying it can't find System.Threading version 4.0.10 when I execute it on the RPi. I've tried to add this via NuGet but no difference. I can see System.Threading.dll on the Pi, it's version 4.6 though, but I have no place to configure an assembly redirect, etc.

How can I make this simple app work with .NET Core RC2 and RPi? (Note that the example above just shows what causes it to crash, it's not a real program and I'm not looking to just do a delay, it's just a sample that shows the crash when you access anything on System.Threading.)

Here are the exception details: Could not load file or assembly 'System.Threading, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) This happens when I try to instantiate the class that has the lines above.

Here's the project.json:

{
  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0",
    "System.Threading": "4.0.10"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}

I have tried with and without the System.Threading in there, same issue.

I try to just run/debug this (on the remote machine) with F5, in debug. Everything is sent over to the RPi as it should, and if I remove the reference to Threading then it runs fine. I have tried both build 10586 and the latest 10.0.14342.1000.


回答1:


I've tried to reinstall Visual Studio, etc. I also uninstalled .NET Core RC2, it wasn't related to that either. What finally fixed it was deleting the %userprofile%.nuget folder so all packages gets re-downloaded. I assume something must've become corrupt or something.



来源:https://stackoverflow.com/questions/37495572/cant-find-system-threading-4-0-10-on-raspberry-pi-on-windows-10-iot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!