Coder Social home page Coder Social logo

aspnet / dnx Goto Github PK

View Code? Open in Web Editor NEW
968.0 197.0 228.0 20.99 MB

OBSOLETE - see readme

License: Other

Shell 5.12% C# 39.80% C 0.15% C++ 50.41% Makefile 1.08% Batchfile 0.04% CMake 0.28% Python 2.82% HTML 0.01% PowerShell 0.01% M4 0.28% Objective-C 0.01%

dnx's Introduction

dnx's People

Contributors

ajaybhargavb avatar alxandr avatar analogrelay avatar billhiebert avatar brennanconroy avatar bricelam avatar chengtian avatar dagood avatar damianedwards avatar davidfowl avatar dougbu avatar eilon avatar ellismg avatar gfraiteur avatar glennc avatar graemechristie avatar hishamco avatar jhawk42 avatar jrieken avatar juntaoluo avatar kichalla avatar kirthik avatar lodejard avatar loudej avatar ntaylormullen avatar pakrym avatar pmoneda avatar pranavkm avatar rynowak avatar troydai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dnx's Issues

Add ability to compile against a dll with fully embedded references

For ANIs we need the ability to compile against a carrier dll with interfaces that are neutral. This is related to #34

Here's the code that can be used to get the resource stream from a PEReader.

public static unsafe Stream GetEmbeddedResourceStream(this PEReader peReader, ManifestResource resource)
{
    if (!resource.Implementation.IsNil)
    {
        throw new ArgumentException("Resource is not embedded in the PE file.", "resource");
    }

    checked // arithmetic overflow here could cause AV
    {
        // Locate start and end of PE image in unmanaged memory.
        IntPtr peImageStartAsIntPtr;
        int peImageSize;
        peReader.GetEntireImage(out peImageStartAsIntPtr, out peImageSize);
        byte* peImageStart = (byte*)peImageStartAsIntPtr;
        byte* peImageEnd = peImageStart + peImageSize;
        Debug.Assert(peImageStart != null && peImageSize > 0);

        // Locate offset to resources within PE image.
        int offsetToResources;
        if (!peReader.PEHeaders.TryGetDirectoryOffset(peReader.PEHeaders.CorHeader.ResourcesDirectory, out offsetToResources))
        {
            throw new InvalidDataException("Failed to get offset to resources in PE file.");
        }
        Debug.Assert(offsetToResources > 0);
        byte* resourceStart = peImageStart + offsetToResources + resource.Offset;

        // Get the length of the the resource from the first 4 bytes.
        if (resourceStart >= peImageEnd - sizeof(int))
        {
            throw new InvalidDataException("resource offset out of bounds.");
        }
        int resourceLength = *(int*)(resourceStart);
        resourceStart += sizeof(int);
        if (resourceLength < 0 || resourceStart >= peImageEnd - resourceLength)
        {
            throw new InvalidDataException("resource offset or length out of bounds.");
        }

        return new UnmanagedMemoryStream(resourceStart, resourceLength);
    }
}

K restore should unpack nuspec

Today k restore doesn't unpack the nuspec. This means that we have to crack the zip at runtime to resolve dependencies.

build.com will not add correct reference to net45 project

I have a following reference in project.json

{
  "version" : "0.1-alpha-*",
  "dependencies": {
    "System.Net.Http": "",
    "Xunit": "1.9.1",
    "xunit.extensions": "1.9.1"
  },
  "configurations": {
    "net45": { }
  }
}

Though the build process is successful, the new generated net45 csproj doesn't contain a reference to the System.Net.Http,

Enable server GC

Add the STARTUP_SERVER_GC flag to the list of startup flags in klr.core45.

Sampe HelloWord.net45 is broken

Error   2   'HelloShared.HelloSharedCode' is inaccessible due to its protection level   C:\gitk\KRuntime\samples\HelloWorld\Program.cs  7   46  HelloWorld.net45
Error   3   'HelloShared.HelloSharedCode' does not contain a definition for 'SharedMethod'  C:\gitk\KRuntime\samples\HelloWorld\Program.cs  7   62  HelloWorld.net45

Add support for different kinds of references

We have identified at least 4 kinds of references that will exist in the system and associated behaviors.

  • Development time references
  • References that get compiled away (don't end up in the nuget package)
  • Private references

Null ref when load from Remote share using LocalPackageRepository

When trying to launch a simple webapp with Helios when the packages are from a remote share we get this exception intermittently.

Information: [NuGetDependencyResolver]: Helios 0.1-alpha-085, Microsoft.AspNet.Loader.IIS.Interop 0.1-alpha-085, Microsoft.AspNet.Loader.IIS 0.1-alpha-085, Microsoft.AspNet.Abstractions 0.1-alpha-143, Microsoft.AspNet.DependencyInjection 0.1-alpha-155, Microsoft.AspNet.Hosting 0.1-alpha-115, Microsoft.AspNet.HttpFeature 0.1-alpha-143, Microsoft.Win32.SafeHandles 4.0.0.0, System.Collections 4.0.0.0, System.ComponentModel 4.0.0.0, System.Diagnostics.Debug 4.0.10.0, System.Diagnostics.Tools 4.0.0.0, System.Globalization 4.0.10.0, System.IO 4.0.0.0, System.IO.FileSystem 4.0.0.0, System.IO.FileSystem.Primitives 4.0.0.0, System.Linq 4.0.0.0, System.Reflection 4.0.10.0, System.Resources.ResourceManager 4.0.0.0, System.Runtime 4.0.20.0, System.Runtime.Extensions 4.0.10.0, System.Runtime.Hosting 3.9.0.0, System.Runtime.InteropServices 4.0.10.0, System.Text.Encoding 4.0.10.0, System.Text.Encoding.Extensions 4.0.10.0, System.Threading 4.0.0.0, System.Threading.Tasks 4.0.0.0, System.Threading.ThreadPool 4.0.10.0, Microsoft.AspNet.ConfigurationModel 0.1-alpha-107, Microsoft.AspNet.FeatureModel 0.1-alpha-143, Microsoft.AspNet.PipelineCore 0.1-alpha-143, Microsoft.AspNet.Security.DataProtection 0.1-alpha-090, System.Console 4.0.0.0, System.Reflection.Primitives 4.0.0.0, System.Reflection.Compatibility 4.0.0.0
PackagePath: Helios.0.1-alpha-085\Helios.0.1-alpha-085.nupkg

System.NullReferenceException: Object reference not set to an instance of an object.
   at NuGet.LocalPackageRepository.GetPackage(Func`2 openPackage, String path)
   at NuGet.LocalPackageRepository.<>c__DisplayClass4.<FindPackage>b__6(String path)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at NuGet.LocalPackageRepository.FindPackage(Func`2 openPackage, String packageId, SemanticVersion version)
   at NuGet.LocalPackageRepository.FindPackage(String packageId, SemanticVersion version)
   at Microsoft.Net.Runtime.Loader.NuGet.NuGetDependencyResolver.FindCandidate(String name, SemanticVersion version)
   at Microsoft.Net.Runtime.Loader.NuGet.NuGetDependencyResolver.Initialize(IEnumerable`1 packages, FrameworkName targetFramework)
   at Microsoft.Net.Runtime.WalkContext.Populate(FrameworkName frameworkName)
   at Microsoft.Net.Runtime.DependencyWalker.Walk(String name, SemanticVersion version, FrameworkName targetFramework)
   at Microsoft.Net.Runtime.DefaultHost.GetEntryPoint(String applicationName)
   at Microsoft.Net.ApplicationHost.Program.<ExecuteMain>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Net.ApplicationHost.Program.<Main>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Net.Runtime.Common.EntryPointExecutor.<Execute>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at klr.host.Bootstrapper.<Main>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at klr.hosting.RuntimeBootstrapper.<Execute>d__1.MoveNext()

Internalize JSON.NET dependency

Today we're using JSON.NET as a package and that's no good for apps and frameworks that use this framework. This is part of the work #29

Error when trying to unzip nuget packages

System.NotSupportedException: This operation is not supported.
1>     at System.IO.Compression.DeflateStream.get_Length()
1>     at NuGet.OptimizedZipPackage.EnsurePackageFiles()
1>     at NuGet.OptimizedZipPackage.GetAssemblyReferencesCore()
1>     at NuGet.LocalPackage.get_AssemblyReferences()
1>     at Microsoft.Net.Runtime.Loader.NuGet.NuGetDependencyResolver.<GetAssembliesFromPackage>d__3.MoveNext()
1>     at Microsoft.Net.Runtime.Loader.NuGet.NuGetDependencyResolver.Initialize(IEnumerable`1 packages, FrameworkName targetFramework)
1>     at Microsoft.Net.Runtime.WalkContext.Populate(FrameworkName frameworkName)
1>     at Microsoft.Net.Runtime.DependencyWalker.Walk(String name, SemanticVersion version, FrameworkName targetFramework)
1>     at Microsoft.Net.Project.ProjectManager.PrepareCompiler(Project project, FrameworkName targetFramework)
1>     at Microsoft.Net.Project.ProjectManager.Build(Project project, String outputPath, FrameworkName targetFramework, PackageBuilder builder, List`1 diagnostics)
1>     at Microsoft.Net.Project.ProjectManager.Build()

Blocker: Unable to resolve AspNet.Logging dependency

Unable to build after adding a dependency to Logging.

Error:
klr.exe Error: 0 : Unable to resolve dependency 'Microsoft.AspNet.DependencyInjection 0.1-alpha' for target framework 'K,Version=v1.0'.
Unable to resolve dependency 'Microsoft.AspNet.Logging 0.1-alpha' for target framework 'K,Version=v1.0'.
klr.exe Information: 0 : Compile took 348ms
warn: Exit code -1 from C:\dev\aspnet\Data\packages\ProjectK.0.1-alpha-026\tools\k.cmd
verbose: Stack trace:
at View906e5505dc1543b4840c59f163907111.<>c__DisplayClass38.b__20() in c:\Users\anpete\AppData\Local\Temp\d0bc4fe2e7ce4a03b018469686749fd9-1.cs:line 2874

Compile for new server(*) platforms

  1. klr.exe, klr.core45.dll
  • Link against MinCore.lib for Win8 API Sets (instead of defaults like kernel32.lib)
  • Link against new server(*) compatible CRT
  1. C# code Update pinvokes to use api-ms-win*.dlls instead of going directly to things like kernel32.dll

Add support for global.json file to allow configuring where dependencies go

Today we look for references relative to the project. This fails when you have a folder structure that doesn't strictly match this. So imagine a file at the solution level with the following contents:

{
  "projects": ["src"],
  "packages": ["packages"]
}

The above tells the roslyn loader to look for projects references in $/src and the nuget assembly loader to look in $/packages for packages.

Add host configuration

We need a more configurable API and an external file format for changing host (core CLR) settings.

Assembly file paths from --lib option

Top level switches should take --lib option for paths to load assemblies from. Should accept semicolon delimited value. Should also accept multiple --lib options.

Custom nuspec files

Projects should be allowed to supply their own nuspec file. This would light up many NuGet features that are currently not possible.

Scenario 1
The xunit.core project needs to include additional files for the TestDriven.Net runner. This includes two assemblies that need to be in the lib folder, but should not be referenced by consuming projects.

Scenario 2
The Microsoft.Data.SQLite project also needs to include the native sqlite3.dll library.

Expose ILibraryManager

[AssemblyNeutral]
public interface ILibraryInformation
{
    string Name { get; }
    IEnumerable<string> Dependencies { get; }
}

[AssemblyNeutral]
public interface ILibraryManager
{
    ILibraryExport GetLibraryExport(string name);

    IEnumerable<ILibraryInformation> GetReferencingLibraries(string name);

    ILibraryInformation GetLibraryInformation(string name);

    IEnumerable<ILibraryInformation> GetLibraries();
}

This exposes the rich dependency graph to the application. This needs to work at the ApplicationHost level as well as the klr.host level. This means that we need to serialize the dependency graph when building the precompiled version of the application.

GAC assemblies aren't been solved

In this case System.Net.Http can't be found

I’m experimenting adding some test to MvcSample in WebFx therefore HttpClient is required.

I added System.Net.Http to project.json

{
  "version" : "0.1-alpha-*",
  "dependencies": {
    "Microsoft.AspNet.Abstractions": "0.1-alpha-*",
    "Microsoft.AspNet.DependencyInjection" : "0.1-alpha-*",
    "Microsoft.AspNet.Routing" : "0.1-alpha-*",
    "Microsoft.AspNet.Mvc" : "",
    "Microsoft.AspNet.Mvc.Startup" : ""
  },
  "configurations": {
    "net45": {
      "dependencies": {
          "Owin": "1.0",
          "Microsoft.Owin": "2.1.0",
          "Microsoft.Owin.Diagnostics": "2.1.0",
          "Microsoft.Owin.Hosting": "2.1.0",
          "Microsoft.Owin.Host.HttpListener": "2.1.0",
          "Microsoft.AspNet.AppBuilderSupport": "0.1-alpha-*",
          "System.Net.Http": ""
       }
    },
    "k10" : { }
  }
}

As well as reference to HttpClient:

using System;
#if NET45
using System.Diagnostics;
using Microsoft.Owin.Hosting;
using System.Net.Http;
#endif

namespace MvcSample
{
    public class Program
    {
        const string baseUrl = "http://localhost:9001/";

        public static void Main()
        {
#if NET45
            var client = new HttpClient();

            using (WebApp.Start<Startup>(new StartOptions(baseUrl)))
            {
                Console.WriteLine("Listening at {0}", baseUrl);
                Process.Start(baseUrl);
                Console.WriteLine("Press any key to exit");
                Console.ReadKey();
            }
#else
            Console.WriteLine("Hello World");
#endif
        }
    }
}

The VS project can be built. But at runtime klr failed when trying to compile the sample:

C:\gitk\WebFx\samples\MvcSample\Program.cs(17,30): error CS0246: The type or namespace name 'HttpClient' could not be found (are you missing a using directive or an assembly reference?)
   at Microsoft.Net.Runtime.Loader.AssemblyLoader.LoadAssembly(LoadContext loadContext)
   at Microsoft.Net.Runtime.DefaultHost.Load(String name)
   at klr.host.HostContainer.Load(String name)
   at klr.hosting.RuntimeBootstrapper.<>c__DisplayClass0.<Execute>b__10(AssemblyName assemblyName)
klr.exe Error: 0 : System.Exception: C:\gitk\WebFx\samples\MvcSample\Program.cs(5,18): error CS0234: The type or namespace name 'Http' does not exist in the namespace 'System.Net' (are you missing an assembly reference?)
C:\gitk\WebFx\samples\MvcSample\Program.cs(17,30): error CS0246: The type or namespace name 'HttpClient' could not be found (are you missing a using directive or an assembly reference?)
   at Microsoft.Net.Runtime.Loader.AssemblyLoader.LoadAssembly(LoadContext loadContext)
   at Microsoft.Net.Runtime.DefaultHost.Load(String name)
   at klr.host.HostContainer.Load(String name)
   at klr.hosting.RuntimeBootstrapper.<>c__DisplayClass0.<Execute>b__10(AssemblyName assemblyName)
   at klr.hosting.RuntimeBootstrapper.<>c__DisplayClass0.<Execute>b__13(Object sender, ResolveEventArgs a)
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)

I checked my GAC, the System.Net.Http is there:

C:\Program Files (x86)\Microsoft Visual Studio 11.0>gacutil /l System.Net.Http
Microsoft (R) .NET Global Assembly Cache Utility.  Version 4.0.30319.18020
Copyright (c) Microsoft Corporation.  All rights reserved.

The Global Assembly Cache contains the following assemblies:
  System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d5
0a3a, processorArchitecture=MSIL

Number of items = 1

Add support for k package command for deployment

c:\myapp\mywebsite> k package --out ..\artifacts\site

The output looks like:

c:\myapp\artifacts\site

mywebsite\ - static files or static files and code files
packages\ - The packages minimal folders for things used in the application
logs\ - website logs
​```

Add support for development dependencies

In the project.json file, let the developer specify that a dependency is development time only depednency:

{
  "dependencies" : {
    "StyleCop" :  { "version" : "1.0-alpha-*", "type": "development" }
  }
}

This means it'll only be a dependency for meta programming and other development time activities.

parent #37

Reference source files outside of the project directory

I've been working on adding project.json files to our xunit fork. Most projects reference source files outside of the project directory. I tried using the shared source feature implemented in #20, but it was very awkward since not all of the projects shared the same set of source files, and even shared source from unreferenced projects. To illustrate, here are a few of the projects and the files they link to.

  • xunit.assert
    • ..\common\GlobalAssemblyInfo.cs
  • xunit.core (doesn't reference xunit.assert)
    • ..\common\GlobalAssemblyInfo.cs
    • ..\common\Guard.cs
    • ..\xunit.assert\Asserts\Sdk\AssertEqualityComparer.cs
    • ..\xunit.assert\Asserts\Sdk\AssertEqualityComparerAdapter.cs
  • xunit.execution (doesn't reference xunit.assert)
    • ..\common\DictionaryExtensions.cs
    • ..\common\ExceptionExtensions.cs
    • ..\common\GlobalAssemblyInfo.cs
    • ..\common\Guard.cs
    • ..\common\SerializationInfoExtensions.cs
    • ..\common\SourceInformation.cs
    • ..\common\TestDiscoveryVisitor.cs
    • ..\common\TestOptionsNames.cs
    • ..\xunit.assert\Asserts\Sdk\AssertEqualityComparer.cs
    • ..\xunit.assert\Asserts\Sdk\AssertEqualityComparerAdapter.cs

I could restructure the repository to accomplish what I want using the existing shared source feature, but I would much rather just be able to reference individual files that are outside of the current project directory.

Add support for meta programming

Everything under Compilers/Preprocess/*/.cs will become an independent assembly. The assembly needs to implement an ICompileModule:

[AssemblyNeutral]
public interface ICompileModule
{
    void BeforeCompile(IBeforeCompileContext context);
    void AfterCompile(IAfterCompileContext context);
}

[AssemblyNeutral]
public interface IBeforeCompileContext
{
    CSharpCompilation CSharpCompilation { get; set; }
    IList<ResourceDescription> Resources { get; }
    IList<Diagnostic> Diagnostics { get; }
}

[AssemblyNeutral]
public interface IAfterCompileContext
{
    CSharpCompilation CSharpCompilation { get; set; }

    IList<Diagnostic> Diagnostics { get; }
}

The current compilation context will be passed into the process method and a compilation will be expected in return.

  • This will be called at runtime, build time and design time (in the DTH)
  • It will use the application's dependencies as well as development dependencies (see #38)
  • This is the same interface that will be discovered when you want to write a nuget package that wants to meta program assemblies. For example the razor precompiled views will be a standalone nuget package that will be able to turn razor files into C# files precompiled as part of the application assembly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.