DNX and DNVM have been replaced by the new .NET CLI. See:
As a result, we're not accepting anymore changes to this project. Please file any new issues on http://github.com/dotnet/cli.
OBSOLETE - see readme
License: Other
DNX and DNVM have been replaced by the new .NET CLI. See:
As a result, we're not accepting anymore changes to this project. Please file any new issues on http://github.com/dotnet/cli.
We need to be able to generate native images for the runtime itself and for the application.
parent #47
Since we're going to be compiling the runtime against the implementations (#29), we need to expose some basic services to application code.
k build --native will generate native images for an application's dependencies
parent #35
Trying to compile the following will result in a stackoverflow:
[AssemblyNeutral]
public interface IFoo : IBar
{
}
[AssemblyNeutral]
public interface IBar
{
public IFoo Value { get; }
}
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);
}
}
Today k restore doesn't unpack the nuspec. This means that we have to crack the zip at runtime to resolve dependencies.
special-case for iis/iisexpress wwwroot wake-up sequence
Running via ApplicationHost will use the user's version of roslyn but k build does not. We need to support this.
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,
project Q references package X
X has lib\k10\X.dll
and lib\contract\X.dll
Q-on-k10 should compile with lib\contract\X.dll
and run with lib\k10\X.dll
Q-on-net45 should compile with no X references and run with no X assemblies
Add the STARTUP_SERVER_GC flag to the list of startup flags in klr.core45.
{
"runtimeVersion" : "2.0"
}
If the runtime isn't deployed with the application then hosts like helios can use this to figure out what version of the runtime the application is targeting.
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
Performance of creating the stream from the byte array everytime
We have identified at least 4 kinds of references that will exist in the system and associated behaviors.
If a load request comes in for
A, Version=x, Culture=neutral, PublicKeyToken=xxx
Make sure it can be satisfied by a non strong named assembly
A, Version=x, Culture=neutral, PublicKeyToken=null
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()
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
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()
If a X project.json references a B dependency, and the dependency had only assembly neutral interfaces, the generated A nupkg's nuspec shouldn't declare a dependency on B
Error 1 NuGet Package restore failed for project Microsoft.Net.OwinHost: Unable to find version '2.1.0-rc1-21110-697-dev' of package 'Microsoft.Owin'.. 0 0
parent #47
Integrate the prototype in the loader branch into dev.
project.json
{
"resources" : "{file patterns}",
}
default value: "Compilation/Resources/*/"
Expose a way to get IMetadataReferences from the runtime so that other application/framework code and perform compilations using them.
parent #31
We need a good way to write functional tests for k applications. It would be great if we could write these tests on desktop and run them in the usual test runner.
It would be useful to have the equivalent of HttpRuntime.AppDomainAppPath and AppDomainAppVirtualPath exposed as an API.
We're going to nuke the cached compilation loader and instead, promote projects into packages via k pack so running it doesn't cause compilation to happen.
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
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
We need a more configurable API and an external file format for changing host (core CLR) settings.
Top level switches should take --lib option for paths to load assemblies from. Should accept semicolon delimited value. Should also accept multiple --lib options.
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.
The file watcher is turned off by default while doing a k web or k run. Need a way to turn this on during development time.
The following assemblies need to be compiled against implementations so that the application running on K isn't affected:
[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.
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
currently it fails, workaround is to delete output folder before running pack
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
```
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
As explained in aspnet/Mvc#12, there are a couple of scenarios such as view generation where we may need to use the root namespace.
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.
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.
Today they are compiled away from the current compilation and embedded as resources. We need a way to produce and output that does not do that as a typing aid.
It's taking up space
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.