You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 13, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 13, 2026. It is now read-only.
small program that calls a rest service using http client and parses the results with newtonsoft json.
works ok without native.
Here's the error I get when building with -n option:
Input Assembly: /Users/mbluestein/ConsoleClientDotnetCore/bin/Debug/dnxcore50/ConsoleClientDotnetCore.dll
Error: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Internal.TypeSystem.Ecma.EcmaType.GetFinalizer()
at Internal.TypeSystem.MetadataType.get_HasFinalizer()
at ILCompiler.JitHelper.GetNewObjectHelperForType(TypeDesc type)
at ILCompiler.DependencyAnalysis.ReadyToRunHelperNode.EmitCode(NodeFactory factory, X64Emitter& encoder, Boolean relocsOnly)
at ILCompiler.DependencyAnalysis.AssemblyStubNode.GetData(NodeFactory factory, Boolean relocsOnly)
at ILCompiler.DependencyAnalysis.ObjectNode.GetStaticDependencies(NodeFactory context)
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.GetStaticDependenciesImpl(DependencyNodeCore`1 node)
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ProcessMarkStack()
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes()
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.get_MarkedNodeList()
at ILCompiler.Compilation.CompileSingleFile()
at ILCompiler.Program.Run(String[] args)
at ILCompiler.Program.Main(String[] args)
You'll typically see this crashing here if the program (or one of the assemblies it refers to) ended up referencing mscorlib and System.Object from mscorlib. The CoreRT compiler doesn't have compatibility shims that would make this work and we didn't invest in diagnostics for invalid inputs yet.
All assemblies fed to ILC need to be compiled against the .NET Core contracts (and use System.Object from the System.Runtime contract).
I tried removing newtonsoft.json, thinking that may be the culprit, but to no avail. I'm only taking System.Net.Http as a dependency and get the same error. Here's my project.json:
The biggest problem is the dnxcore50 moniker. That means CoreCLR and it's quite likely it ends up using assemblies that are written for CoreCLR.
We're getting away with it in our testing because we only use a limited subset that is "known good" and provide overrides in the Microsoft.DotNet.AppDep package for everything else. The framework team is not making bigger investments in this area yet and is waiting until the compiler gets more mature. We're getting there.
Activity
MichalStrehovsky commentedon May 2, 2016
You'll typically see this crashing here if the program (or one of the assemblies it refers to) ended up referencing
mscorlibandSystem.Objectfrommscorlib. The CoreRT compiler doesn't have compatibility shims that would make this work and we didn't invest in diagnostics for invalid inputs yet.All assemblies fed to ILC need to be compiled against the .NET Core contracts (and use
System.Objectfrom theSystem.Runtimecontract).mikebluestein commentedon May 2, 2016
I tried removing newtonsoft.json, thinking that may be the culprit, but to no avail. I'm only taking System.Net.Http as a dependency and get the same error. Here's my project.json:
MichalStrehovsky commentedon May 2, 2016
The biggest problem is the
dnxcore50moniker. That means CoreCLR and it's quite likely it ends up using assemblies that are written for CoreCLR.We're getting away with it in our testing because we only use a limited subset that is "known good" and provide overrides in the
Microsoft.DotNet.AppDeppackage for everything else. The framework team is not making bigger investments in this area yet and is waiting until the compiler gets more mature. We're getting there.