无法在Mac上为iOS运行Uno项目-无法加载SQLitePCLRaw.core

时间:2019-01-10 22:22:09

标签: ios sqlite xamarin uno uno-platform

我有一个UWP应用程序,已使用Uno平台移植到iOS和Android。我可以在Windows上构建并运行iOS项目,但是当我尝试在Mac上运行它时,出现以下错误:

  

错误:System.TypeLoadException:无法加载字段'Microsoft.CodeAnalysis.SQLite.Interop.SqlConnection:_handle'(0)的类型,原因是:无法加载文件或程序集'SQLitePCLRaw.core,Version = 1.0.0.0 ,Culture = neutral,PublicKeyToken = 1488e028ca7ab535'或其依赖项之一。

即使我添加对该程序包的引用,错误仍然存​​在,并且我无法运行该项目。完整的堆栈跟踪如下:

/.../MyProject/packages/Uno.SourceGenerationTasks.1.28.0/build/Xamarin.iOS10/Uno.SourceGenerationTasks.targets(4,4): Error: System.TypeLoadException: Could not load type of field 'Microsoft.CodeAnalysis.SQLite.Interop.SqlConnection:_handle' (0) due to: Could not load file or assembly 'SQLitePCLRaw.core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1488e028ca7ab535' or one of its dependencies.
  at (wrapper managed-to-native) System.RuntimeType.GetPropertiesByName_native(System.RuntimeType,intptr,System.Reflection.BindingFlags,bool)
  at System.RuntimeType.GetPropertiesByName (System.String name, System.Reflection.BindingFlags bindingAttr, System.Boolean icase, System.RuntimeType reflectedType) [0x00011] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/corlib/ReferenceSources/RuntimeType.cs:516 
  at System.RuntimeType.GetPropertyCandidates (System.String name, System.Reflection.BindingFlags bindingAttr, System.Type[] types, System.Boolean allowPrefixLookup) [0x00010] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/rttype.cs:2881 
  at System.RuntimeType.GetProperties (System.Reflection.BindingFlags bindingAttr) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/rttype.cs:3089 
  at System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperties (System.Type type) [0x00006] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/reflection/RuntimeReflectionExtensions.cs:25 
  at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverPropertyExports>d__7.MoveNext () [0x00030] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector+<DiscoverExports>d__5.MoveNext () [0x000dc] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.Discovery.TypeInspector.InspectTypeForPart (System.Reflection.TypeInfo type, System.Composition.TypedParts.Discovery.DiscoveredPart& part) [0x00061] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.TypedParts.TypedPartExportDescriptorProvider..ctor (System.Collections.Generic.IEnumerable`1[T] types, System.Composition.Convention.AttributedModelProvider attributeContext) [0x00037] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at System.Composition.Hosting.ContainerConfiguration.CreateContainer () [0x00042] in <9aac21a4a3f24063b2b8b59143acddfc>:0 
  at Microsoft.CodeAnalysis.Host.Mef.MefHostServices.Create (System.Collections.Generic.IEnumerable`1[T] assemblies) [0x0001e] in <c187f126c4894c9b948a9aabdfa3b3e0>:0 
  at Microsoft.CodeAnalysis.Host.Mef.DesktopMefHostServices.get_DefaultServices () [0x00011] in <7dc846b9b711473199b9a1835d0b3ea9>:0 
  at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create (System.Collections.Generic.IDictionary`2[TKey,TValue] properties) [0x00000] in <7dc846b9b711473199b9a1835d0b3ea9>:0 
  at Uno.SourceGeneration.Host.SourceGeneratorHost.GetCompilation () [0x00125] in <a8efa0c74d824a2d829abc1245eef090>:0  (UnoSample.iOS)

我正在使用Uno.Platform的最新发行版(未预发行):

  <package id="Uno.CodeGen" version="1.29.0" targetFramework="xamarinios10" />
  <package id="Uno.Core" version="1.25.0" targetFramework="xamarinios10" />
  <package id="Uno.Core.Build" version="1.25.0" targetFramework="xamarinios10" />
  <package id="Uno.Equality" version="1.29.0" targetFramework="xamarinios10" />
  <package id="Uno.Immutables" version="1.29.0" targetFramework="xamarinios10" />
  <package id="Uno.Injectable" version="1.29.0" targetFramework="xamarinios10" />
  <package id="Uno.SourceGenerationTasks" version="1.28.0" targetFramework="xamarinios10" />
  <package id="Uno.UI" version="1.42.0" targetFramework="xamarinios10" />

是否可以运行在Mac上使用Uno平台开发的iOS应用?

2 个答案:

答案 0 :(得分:3)

正如安德列斯(Andres)所述,此问题已在最新开发人员中修复。如果需要,可以在我们的Gitter频道上获得更多帮助:https://gitter.im/uno-platform/Lobby#

答案 1 :(得分:0)

我试图将Uno.UI软件包更新为最新的预发行版-它没有帮助。我不仅需要更新Uno.UI软件包,还必须手动更新所有未使用Uno.UI提取的相关软件包:

  <package id="Uno.CodeGen" version="1.30.0-dev.107" targetFramework="xamarinios10" />
  <package id="Uno.Core" version="1.26.0-dev.61" targetFramework="xamarinios10" />
  <package id="Uno.Core.Build" version="1.26.0-dev.61" targetFramework="xamarinios10" />
  <package id="Uno.Equality" version="1.30.0-dev.107" targetFramework="xamarinios10" />
  <package id="Uno.Immutables" version="1.30.0-dev.107" targetFramework="xamarinios10" />
  <package id="Uno.Injectable" version="1.30.0-dev.107" targetFramework="xamarinios10" />
  <package id="Uno.Roslyn" version="1.2.0-dev.18" targetFramework="xamarinios10" />
  <package id="Uno.SourceGenerationTasks" version="1.29.0-dev.226" targetFramework="xamarinios10" />
  <package id="Uno.UI" version="1.43.0-dev.614" targetFramework="xamarinios10" />

此软件包列表正常工作。