davidfowl / ProjectJsonWorkspace

3 stars 6 forks source link

Problems running the sample project #1

Open pdelvo opened 9 years ago

pdelvo commented 9 years ago

Hi!

I tried running the sample projects and I am running in a few problems:

Unbehandelte Ausnahme: System.Reflection.TargetInvocationException: Ein Aufrufziel hat einen Ausnahmefehler verursacht. ---> System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
   bei Microsoft.Framework.Runtime.RuntimeEnvironmentHelper.GetRuntimeEnvironment()
   bei Microsoft.Framework.Runtime.RuntimeEnvironmentHelper.<>c.<.cctor>b__8_2()
   bei System.Lazy`1.CreateValue()
   bei System.Lazy`1.LazyInitValue()
   bei System.Lazy`1.get_Value()
   bei Microsoft.Framework.Runtime.RuntimeEnvironmentHelper.<>c.<.cctor>b__8_0()
   bei System.Lazy`1.CreateValue()
   bei System.Lazy`1.LazyInitValue()
   bei System.Lazy`1.get_Value()
   bei Microsoft.Framework.Runtime.FrameworkReferenceResolver.GetReferenceAssembliesPath()
   bei Microsoft.Framework.Runtime.FrameworkReferenceResolver.GetFrameworkInformation(FrameworkName targetFramework)
   bei System.Collections.Generic.DictionaryExtensions.GetOrAdd[TKey,TValue](IDictionary`2 dictionary, TKey key, Func`2 factory)
   bei Microsoft.Framework.Runtime.FrameworkReferenceResolver.TryGetAssembly(String name, FrameworkName targetFramework, String& path, Version& version)
   bei Microsoft.Framework.Runtime.ReferenceAssemblyDependencyResolver.GetDescription(LibraryRange libraryRange, FrameworkName targetFramework)
   bei Microsoft.Framework.Runtime.WalkContext.Resolve(Dictionary`2 resolvedItems, IEnumerable`1 providers, LibraryRange packageKey, FrameworkName frameworkName)
   bei Microsoft.Framework.Runtime.WalkContext.<>c__DisplayClass1_0.<Walk>b__0(Node node)
   bei Microsoft.Framework.Runtime.WalkContext.<>c__DisplayClass4_0.<ForEach>b__0(Node node, Int32 _)
   bei Microsoft.Framework.Runtime.WalkContext.ForEach[TState](Node root, TState state, Func`3 visitor)
   bei Microsoft.Framework.Runtime.WalkContext.ForEach(Node root, Action`1 visitor)
   bei Microsoft.Framework.Runtime.WalkContext.Walk(IEnumerable`1 dependencyResolvers, String name, SemanticVersion version, FrameworkName frameworkName)
   bei Microsoft.Framework.Runtime.DependencyWalker.Walk(String name, SemanticVersion version, FrameworkName targetFramework)
   bei Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectModel.<>c__DisplayClass8_0.<GetApplicationHostContext>b__0(CacheContext ctx) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectMod
el.cs:Zeile 175.
   bei Microsoft.Framework.Runtime.Caching.CacheExtensions.<>c__DisplayClass0_0`1.<Get>b__0(CacheContext ctx)
   bei Microsoft.Framework.Runtime.Caching.Cache.CreateEntry(Object k, Func`2 acquire)
   bei Microsoft.Framework.Runtime.Caching.Cache.<>c__DisplayClass5_0.<AddEntry>b__0()
   bei System.Lazy`1.CreateValue()
   bei System.Lazy`1.LazyInitValue()
   bei System.Lazy`1.get_Value()
   bei Microsoft.Framework.Runtime.Caching.Cache.Get(Object key, Func`2 factory)
   bei Microsoft.Framework.Runtime.Caching.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
   bei Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectModel.GetApplicationHostContext(Project project, String configuration, FrameworkName frameworkName) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Wo
rkspaces.Dnx\ProjectModel.cs:Zeile 165.
   bei Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectModel.<>c__DisplayClass7_0.<ResolveDependencyInfo>b__0(CacheContext ctx) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectModel.c
s:Zeile 78.
   bei Microsoft.Framework.Runtime.Caching.CacheExtensions.<>c__DisplayClass0_0`1.<Get>b__0(CacheContext ctx)
   bei Microsoft.Framework.Runtime.Caching.Cache.CreateEntry(Object k, Func`2 acquire)
   bei Microsoft.Framework.Runtime.Caching.Cache.<>c__DisplayClass5_0.<AddEntry>b__0()
   bei System.Lazy`1.CreateValue()
   bei System.Lazy`1.LazyInitValue()
   bei System.Lazy`1.get_Value()
   bei Microsoft.Framework.Runtime.Caching.Cache.Get(Object key, Func`2 factory)
   bei Microsoft.Framework.Runtime.Caching.CacheExtensions.Get[T](ICache cache, Object key, Func`2 factory)
   bei Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectModel.ResolveDependencyInfo(Project project, FrameworkName frameworkName) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectModel.
cs:Zeile 76.
   bei Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectModel.GetModel(String path) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectModel.cs:Zeile 38.
   bei Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectJsonWorkspace.AddProject(String projectPath) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectJsonWorkspace.cs:Zeile 38.
   bei Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectJsonWorkspace.Initialize() in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectJsonWorkspace.cs:Zeile 32.
   bei Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectJsonWorkspace..ctor(String[] projectPaths) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectJsonWorkspace.cs:Zeile 25.
   bei Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectJsonWorkspace..ctor(String projectPath) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectJsonWorkspace.cs:Zeile 17.
   bei Program.Do(String path) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\samples\Sample\Program.cs:Zeile 27.
   bei Program.Main() in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\samples\Sample\Program.cs:Zeile 21.
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   bei Microsoft.Dnx.ApplicationHost.Program.ExecuteMain(DefaultHost host, String applicationName, String[] args)
   bei Microsoft.Dnx.ApplicationHost.Program.Main(String[] args)
--- Ende der Stapelüberwachung vom vorhergehenden Ort, an dem die Ausnahme ausgelöst wurde ---
   bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   bei Microsoft.Dnx.Runtime.Common.EntryPointExecutor.Execute(Assembly assembly, String[] args, IServiceProvider serviceProvider)
   bei Microsoft.Dnx.Host.Bootstrapper.RunAsync(List`1 args, IRuntimeEnvironment env, FrameworkName targetFramework)
   bei Microsoft.Dnx.Host.RuntimeBootstrapper.ExecuteAsync(String[] args, FrameworkName targetFramework)
   bei Microsoft.Dnx.Host.RuntimeBootstrapper.Execute(String[] args, FrameworkName targetFramework)
   --- Ende der internen Ausnahmestapelüberwachung ---
   bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   bei Microsoft.Dnx.Host.Clr.RuntimeBootstrapper.Execute(String[] argv, FrameworkName targetFramework)
   bei DomainManager.Main(Int32 argc, String[] argv)

I noticed that it works if I change the sample to use dnx core instead. Then I get a bit further and I get a NullReferenceException in ProjectExportProviderHelper.GetExportsRecursive with this stacktrace:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Framework.Runtime.ProjectExportProviderHelper.GetExportsRecursive(ILibraryManager manager, ILibraryExportProvider libraryExportProvider, CompilationTarget target, Func`2 include)
   at Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectModel.<>c__DisplayClass7_0.<ResolveDependencyInfo>b__0(CacheContext ctx) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectModel.cs
:line 137
   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 System.Lazy`1.get_Value()
   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.CodeAnalysis.Workspaces.Dnx.ProjectModel.ResolveDependencyInfo(Project project, FrameworkName frameworkName) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectModel.c
s:line 76
   at Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectModel.GetModel(String path) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectModel.cs:line 38
   at Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectJsonWorkspace.AddProject(String projectPath) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectJsonWorkspace.cs:line 38
   at Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectJsonWorkspace.Initialize() in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectJsonWorkspace.cs:line 32
   at Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectJsonWorkspace..ctor(String[] projectPaths) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectJsonWorkspace.cs:line 25
   at Microsoft.CodeAnalysis.Workspaces.Dnx.ProjectJsonWorkspace..ctor(String projectPath) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\src\Microsoft.CodeAnalysis.Workspaces.Dnx\ProjectJsonWorkspace.cs:line 17
   at Program.Do(String path) in C:\Users\fisch\Documents\GitHub\ProjectJsonWorkspace\samples\Sample\Program.cs:line 28

I must doing something wrong. Does anyone know what could be causing this?

oryol commented 8 years ago

It should be updated to the new DNX version. Microsoft.Framework.Runtime has been changed to the Microsoft.Dnx.Runtme. That's why yoy're getting null for old IApplicationEnvironment.

davidfowl commented 8 years ago

I'm going to rewrite this library soon.

oryol commented 8 years ago

PR with upgraded runtime: https://github.com/davidfowl/ProjectJsonWorkspace/pull/2