简体   繁体   中英

Windows 10 IoT ARM (Raspberry Pi) System.Threading - missing references

I'm trying to compile UWP C# Solution for Raspberry Pi 2. Here is project.json :

{
 "dependencies": {
  "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
},
"frameworks": {
    "uap10.0": {
    "imports": [
     ]
    }
},
"runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
    }
}

The problem is that im referencing (by dll, i couldn't add it by normal reference to project) to another project, which uses System.Threading for some thread operations. Here is project.json :

{
"version": "1.0.0-*",

"dependencies": {
  "ELMSDefinitionsCore": "1.0.0-*",
  "NETStandard.Library": "1.6.1",
  "System.ComponentModel.Primitives": "4.2.0",
  "System.Xml.XmlSerializer": "4.2.0",
  "UniversalSerialPort": "1.0.0-*",
  "System.Security.Cryptography.Algorithms": "4.0.0",
  "System.Threading.Thread": "4.3.0"
 },

"frameworks": {
  "netcoreapp1.1":
{
    "imports": "dnxcore50",
    "dependencies":
  {
      "Microsoft.NETCore.App":
    {
        "type": "platform",
        "version": "1.1.0"
      }
    }
 },
"netstandard1.4":
{
      "imports": "dnxcore50"
},

 "net462": {
   "dependencies": {
   }
 }
}
}

When compiling I get multiple warnings like this one:

C:\\Program Files (x86)\\MSBuild\\Microsoft.NetNative\\ARM\\ilc\\IlcInternals.targets(936,5): warning : ILTransform_0003: Method 'GroupSelect.StartGroupLoop(byte[])' will always throw an exception due to the missing method 'ThreadStart..ctor(object, IntPtr)'. There may have been a missing assembly.

All the warnings are about referenced library.

I've tried solution from this topic, but nothing helped: Can't find System.Threading 4.0.10 on Raspberry Pi on Windows 10 IoT

I resolved problem.

First of all - in each project referenced by UWP project it's good to have UWP configuration (example of it):

"uap10.0": {
      "imports": "dnxcore50",
                "runtimes": {
        "win10-arm": {},
        "win10-arm-aot": {},
        "win10-x86": {},
        "win10-x86-aot": {},
        "win10-x64": {},
        "win10-x64-aot": {}
      },
      "dependencies": {"System.Threading.Thread": "4.0.10.0" }
}

Second thing - you can't use threads in UWP app. You have to rewrite your threads into async , await and use Task instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM