Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.
This repository was archived by the owner on Dec 18, 2017. It is now read-only.

System.ArgumentNullException on coreclr linux, for dnu build on project.json with embedded items #2187

Closed
@IRooc

Description

@IRooc

For the following project.json:

{
    "version": "1.0.0-*",
    "dependencies": {
        "Microsoft.AspNet.FileProviders.Embedded": "1.0.0-*"
    },
    "commmands":{
        "run":"run"
    },

    "resource" : "test.txt",

    "frameworks": {
        "dnx451": { },
        "dnxcore50": {
            "dependencies":{
                "System.Console": "4.0.0-beta-*"
            }
        }
    }
}

with the following program (which does not matter because the build failes on the project.json itself)

using System;
using System.IO;
using System.Reflection;
using Microsoft.AspNet.FileProviders;

namespace TestDnx {
    public class Program
    {
        public void Main(string[] args){
            var txt = FileContent();
            Console.WriteLine(txt);
        }


        public string FileContent() {
            Console.WriteLine(GetType().GetTypeInfo().Assembly + " " + GetType().Namespace);
            var provider = new EmbeddedFileProvider(GetType().GetTypeInfo().Assembly, GetType().Namespace);

            var fileInfo = provider.GetFileInfo("test.txt");
            using (var stream = fileInfo.CreateReadStream())
            {
                StreamReader reader = new StreamReader(stream);    
                return reader.ReadToEnd();
            }
        }

    }
}

when calling dnu build on linux (ubuntu 14.04 lts) for framework 1.0.0-beta6-12170 coreclr x64 the following exception is thrown:

System.ArgumentNullException: Value cannot be null.
Parameter name: paths
   at System.IO.Path.Combine(String[] paths)
   at Microsoft.Framework.Runtime.GacDependencyResolver.<GetGacSearchPaths>d__6.MoveNext()
   at Microsoft.Framework.Runtime.GacDependencyResolver.TryResolvePartialName(String name, SemanticVersion version, String& assemblyLocation)
   at Microsoft.Framework.Runtime.GacDependencyResolver.GetDescription(LibraryRange libraryRange, FrameworkName targetFramework)
   at Microsoft.Framework.Runtime.WalkContext.Resolve(Dictionary`2 resolvedItems, IEnumerable`1 providers, LibraryRange packageKey, FrameworkName frameworkName)
   at Microsoft.Framework.Runtime.WalkContext.<>c__DisplayClass1_0.<Walk>b__0(Node node)
   at Microsoft.Framework.Runtime.WalkContext.<>c__DisplayClass4_0.<ForEach>b__0(Node node, Int32 _)
   at Microsoft.Framework.Runtime.WalkContext.ForEach[TState](Node root, TState state, Func`3 visitor)
   at Microsoft.Framework.Runtime.WalkContext.ForEach(Node root, Action`1 visitor)
   at Microsoft.Framework.Runtime.WalkContext.Walk(IEnumerable`1 dependencyResolvers, String name, SemanticVersion version, FrameworkName frameworkName)
   at Microsoft.Framework.Runtime.DependencyWalker.Walk(String name, SemanticVersion version, FrameworkName targetFramework)
   at Microsoft.Framework.PackageManager.BuildContext.<>c__DisplayClass16_0.<GetApplicationHostContext>b__0(CacheContext ctx)
   at Microsoft.Framework.Runtime.Caching.CacheExtensions.<>c__DisplayClass0_0`1.<Get>b__0(CacheContext ctx)
   at Microsoft.Framework.Runtime.Caching.Cache.CreateEntry(Object k, Func`2 acquire)
   at Microsoft.Framework.Runtime.Caching.Cache.<>c__DisplayClass5_0.<AddEntry>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Microsoft.Framework.Runtime.Caching.Cache.Get(Object key, Func`2 factory)
   at Microsoft.Framework.Runtime.Caching.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
   at Microsoft.Framework.PackageManager.BuildContext.GetApplicationHostContext(Project project, FrameworkName targetFramework, String configuration)
   at Microsoft.Framework.PackageManager.BuildContext..ctor(IServiceProvider hostServices, IApplicationEnvironment appEnv, ICache cache, ICacheContextAccessor cacheContextAccessor, Project project, FrameworkName targetFramework, String configuration, String outputPath)
   at Microsoft.Framework.PackageManager.BuildManager.BuildInternal(String projectPath)
   at Microsoft.Framework.PackageManager.BuildManager.Build()
   at Microsoft.Framework.PackageManager.BuildConsoleCommand.<>c__DisplayClass0_0.<Register>b__1()
   at Microsoft.Framework.Runtime.Common.CommandLine.CommandLineApplication.Execute(String[] args)
   at Microsoft.Framework.PackageManager.Program.Main(String[] args)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Framework.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   at dnx.host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env)
   at dnx.host.RuntimeBootstrapper.ExecuteAsync(String[] args)
   at dnx.host.RuntimeBootstrapper.Execute(String[] args)

it works fine in the MONO version, and on windows for full and coreclr

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions