首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >UWP -对象引用没有设置为对象的实例。

UWP -对象引用没有设置为对象的实例。
EN

Stack Overflow用户
提问于 2016-06-29 10:51:52
回答 1查看 1.7K关注 0票数 0

升级Microsoft.NETCore.UniversalWindowsPlatform之后,我不能再编译发布中的Xamarin应用程序项目了,因为我得到了一个Internal compiler error: Object reference not set to an instance of an object

我正在使用这些NuGet包

代码语言:javascript
复制
Acr.UserDialogs   5.2.2
ExifLib.PCL   1.0.1   (in portable project)
Microsoft.NETCore.UniversalWindowsPlatform   5.2.0
MR.Gestures   1.3.4
Newtonsoft.Json   7.0.1   (in portable project)
Splat   1.6.2   (in portable project)
SQLite.Net.Core-PCL   3.1.1
SQLite.Net-PCL   3.1.1
Win2D.uwp   1.18.0   (in portable project)
Xam.Plugins.Settings   2.1.0
Xamarin.Forms   2.3.0.107
Xamarin.Insights   1.12.3
XLabs.Core   2.2.0-pre02
XLabs.Forms   2.2.0-pre02
XLabs.IoC   2.2.0-pre02
XLabs.Platform   2.2.0-pre02
XLabs.Serialization   2.2.0-pre02

可以找到一个日志,这里

我希望这里的任何人都能帮我。

所有平台都设置为Compile with .NET Native tool chain

更新

如果我自己构建XLabs并将Compile with .NET Native tool chain设置为未选中的话。这些错误都会发生。

应用程序清单

错误发现:应用程序清单测试检测到以下错误:<project> takes a dependency on Microsoft .Net Native Runtime Package 1.x framework but is missing the framework dependency declaration in the manifest.

二进制分析器

错误发现:二进制分析器测试检测到以下错误:File C:\Program Files\WindowsApps\<project>_1.8.0.0_x64__r1myykanma94r\clrjit.dll has failed the AppContainerCheck check.

支持的API

错误发现:支持的API测试检测到以下错误:

代码语言:javascript
复制
API SystemFunction036 in advapi32.dll is not supported for this application type. clrjit.dll calls this API.
API DebugBreak in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API HeapValidate in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API LoadLibraryExW in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API RtlCaptureContext in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API RtlVirtualUnwind in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API TlsAlloc in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API TlsFree in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API TlsGetValue in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API TlsSetValue in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API UnhandledExceptionFilter in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API VirtualAlloc in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API VirtualProtect in kernel32.dll is not supported for this application type. clrjit.dll calls this API.
API ExecuteAssembly in uwphost.dll is not supported for this application type. <project>.exe calls this API.
API DllGetActivationFactory in uwphost.dll is not supported for this application type. <project>.UWP.exe has an export that forwards to this API.

更新2

我可以轻松地重写代码,所以我不再使用Win2D.uwp了。不知何故,我上周五安装了Microsoft.NETCore.UniversalWindowsPlatform v 5.2.0,但NuGet最新的版本是v 5.1.0。现在我要讲的是这些NuGet包

代码语言:javascript
复制
Acr.UserDialogs   5.3.0
ExifLib.PCL   1.0.1   (in portable project)
Microsoft.NETCore.UniversalWindowsPlatform   5.1.0
MR.Gestures   1.3.4
Newtonsoft.Json   7.0.1   (in portable project)
Splat   1.6.2   (in portable project)
SQLite.Net.Core-PCL   3.1.1
SQLite.Net-PCL   3.1.1
Xam.Plugins.Settings   2.1.0
Xamarin.Forms   2.3.0.107
Xamarin.Insights   1.12.3
XLabs.Core   2.2.0-pre02
XLabs.Forms   2.2.0-pre02
XLabs.IoC   2.2.0-pre02
XLabs.Platform   2.2.0-pre02
XLabs.Serialization   2.2.0-pre02

这个错误发生在The assembly Windows in file C:\Program Files\WindowsApps\<app-name>_1.8.0.0_x64__r1myykanma94r\Windows.winmd has a non-empty exported type reference table. Every Windows Runtime assembly must have an empty exported type reference table.

更新3

我发现卸载Win2D.uwp并自己编译XLabs是可行的。

EN

回答 1

Stack Overflow用户

发布于 2017-05-22 16:19:51

我有这个问题,解决方案很简单:我在我的Newtonsoft.Json.dll和我的UWP项目中都引用了PCL版本的PCL。较早的可移植版本(Portable40)。

在我更新到最新版本的Newtonsoft.Json.dll (NuGet版本9.0.1)之后,编译异常就消失了。

请记住,在更新时,我替换了对Newtonsoft libreary的所有引用,即在我的PCLs中,我现在引用了可移植版本lib\portable-net40+sl5+wp80+win8+wpa81

在我的启动项目中,我现在引用Newtonsoft包(我的project.json文件内容):

代码语言:javascript
复制
{
  "dependencies": {
  "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",
  "Newtonsoft.Json": "9.0.1",
  "Xamarin.Forms": "2.3.2.127"
  },
  "frameworks": {
    "uap10.0": {}
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}

它有效地使用了对C:\Users\<username>\.nuget\packages\newtonsoft.json\9.0.1\lib\portable-net45+wp80+win8+wpa81的引用。

不久前,我在Xamarin论坛上发布了我的解决方案,有些人说这对他们也有帮助。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38097466

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档