Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.NET Core 1.0.0 support #442

Merged
merged 46 commits into from
Jul 2, 2016
Merged

.NET Core 1.0.0 support #442

merged 46 commits into from
Jul 2, 2016

Conversation

lstratman
Copy link
Contributor

Everything under #433.

lstratman added 30 commits May 17, 2016 15:58
First pass at getting the managed components to compile under RC2.
Got edge_coreclr.node to compile and run against the latest RC2 code.
Currently requires you to specify a CORECLR_VERSION environment variable
so that we know which framework to run against, but I'll start figuring
out how to address that going forward.  Also copied over a bunch of
Microsoft's PAL methods from the CLI repository which has nearly
eliminated the OS-specific code that I had.
You are no longer forced to specify a CORECLR_VERSION environment
variable when running Edge.js:  if none is supplied, we will find the
maximum framework version that is installed and use that.
When an environment variable is used (either CORECLR_DIR or
CORECLR_VERSION) to specify a particular CLR target, we will now throw
an error if we fail to load the CLR from those targets.  This is in
contrast to previously where we would simply try to load it from the
next available target.
CoreCLREmbedding is successfully bootstrapped from the unmanaged code
and passes all of the precompiled tests.  Plenty of fit and finish and
refactoring left, as well as getting dynamic compilation working.
Added support for parsing .deps.json in the unmanaged code.
Updated to (mostly) support dynamic compilation under RC2.
If the application dependency manifest has an entry for a bootstrap
assembly (like Newtonsoft.Json) that is greater than the version listed
in the Edge.js dependency manifest, use the application version in the
bootstrap process.
If the dependency manifest for the application indicates a specific
framework version via a dependency on Microsoft.NETCore.App, we will try
to load that version of the framework instead of looking for the highest
installed version.
Running applications can access runtime library and compile library data
using DependencyContext.Default.
Native libraries in packages will now be correctly resolved and loaded
by the dependency loader.
Minor modifications were made to deps_format.cpp to allow the setting of
a runtime ID at runtime instead of relying on a compiler constant.
When checking the PATH for dotnet, we call pal::realpath on the result
when we find it to get the actual CLR directory, which is required for
non-Windows OSes.
When loading the application's dependency manifest file, we now merge in
the shared runtime manifest, which gives us the fallback graph.
lstratman added 7 commits June 9, 2016 17:19
Initial code that moves towards properly abstracting the Edge.js managed
runtime into a NuGet package that users are expected to reference in
their project.json.
For scenarios when someone is just scripting .NET in Node.js without
having a formal application (defined via EDGE_APP_ROOT), we have a
bootstrap application that enables this by specifying the minimum
necessary dependencies.
edge_coreclr.node now builds even if the .NET CLI toolchain is not
installed, which is a requirement for running only published apps.
Updated a bunch of install and usage instructions to reflect the changes
between RC1 and RC2.
Missed a few things...
@brentarias
Copy link

What are the criteria that must be met before this PR (and over a dozen others, such as #437) will be merged? And what timeline?

@tjanczuk
Copy link
Owner

This PR takes priority over any other given the scope of the change. I hope to review and marge by early next week.

When you depend on a module that requires edge and then you require edge
yourself, edge_coreclr.node or edge_nativeclr.node will be loaded and
initialized multiple times.  For edge_coreclr, the CLR will try to load
itself again which will, obviously, result in an error.  So, we set the
EDGE_NATIVE environment variable so that subsequent loads of the edge
module will try to load the native code from the same location and
therefore return the cached copy.
@EricSmekens EricSmekens mentioned this pull request Jun 22, 2016
3. `"emitEntryPoint": true` should be present under `buildOptions`. You can add an empty `Main()` implementation to your project to accomodate it; this method will not be called, but is just a requirement in order for `dotnet publish` to generate a completely standalone app.

On your development machine, you would run `dotnet publish -r [target runtime for your production server]` (i.e. `dotnet publish -r ubuntu.14.04-x64`) to aggregate the package assemblies and native libraries necessary to run your application. You can copy the contents of the publish directory up to your SDK- and CLI-less server and use them directly in Edge.js by setting the `EDGE_APP_ROOT` environment variable to the directory on the server that you copied the published application to.

Copy link
Owner

@tjanczuk tjanczuk Jun 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lstratman what would be useful is "hello, world" samples for .NET Core demonstrating the various options (published app, on the fly compilation).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent idea, I will add a samples directory with the various scenarios, each with their own README.md file indicating how to compile and run them. Might not happen until early next week.

@tjanczuk
Copy link
Owner

tjanczuk commented Jul 1, 2016

@lstratman Is there a reason Edge.js NuGet package does not have a dependency on Edge.js.CSharp, but instead the bootstrap project depends on both?

@lstratman
Copy link
Contributor Author

Since Edge.js.CSharp is only needed for dynamic compilation of C# literals, I didn't want to force that dependency on applications that only reference pre-compiled assemblies. The bootstrap application, on the other hand, was in place so that applications can get up and running quickly with .NET languages quickly (without a project.json), which generally implied the use of dynamic compilation of literals instead of pre-compiled assemblies.

@tjanczuk
Copy link
Owner

tjanczuk commented Jul 1, 2016

Makes sense, thanks!

@tjanczuk
Copy link
Owner

tjanczuk commented Jul 2, 2016

@lstratman Have you ran the test\double\double_test with the Edge.js NuGet package built from the PR bits? This is failing for me with

C:\projects\edge\test\double\double_test\bin\Release>mstest /testcontainer:double_test.dll /noisolation
Microsoft (R) Test Execution Command Line Tool Version 12.0.21005.1
Copyright (c) Microsoft Corporation. All rights reserved.

Loading double_test.dll...
Starting execution...

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indi
cation that other memory is corrupt.
   at EdgeJs.Edge.NodeStart(Int32 argc, String[] argv)
   at EdgeJs.Edge.<>c.<Func>b__10_0()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object
state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, B
oolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

@tjanczuk tjanczuk changed the title .NET Core RC2 support .NET Core 1.0.0 support Jul 2, 2016
@tjanczuk
Copy link
Owner

tjanczuk commented Jul 2, 2016

@lstratman never mind, found it. The entry point to start@node in node.dll has changed, probably as a result of my updating the compiler (since I did not change node version).

@tjanczuk
Copy link
Owner

tjanczuk commented Jul 2, 2016

@tjanczuk
Copy link
Owner

tjanczuk commented Jul 2, 2016

@lstratman did you use test\testall.bat on windows? It is failing for me for all but the most recently built version.

@tjanczuk tjanczuk merged commit 8bcc239 into tjanczuk:master Jul 2, 2016
@tjanczuk
Copy link
Owner

tjanczuk commented Jul 2, 2016

@lstratman figured it out, never mind.

@tjanczuk
Copy link
Owner

tjanczuk commented Jul 2, 2016

This has been huge work @lstratman, thank you! All bits are now released /cc @ChristianWeyer

Edge.js 5.9.2 on Nuget: https://www.nuget.org/packages/Edge.js/5.9.2
Edge.js.CSharp 1.0.0 on Nuget: https://www.nuget.org/packages/Edge.js.CSharp/
[email protected] on NPM: https://www.npmjs.com/package/edge

I will be out for a week now, I will do some promo around it when back. Maybe I will update to Node 6.x before.

Again, fantastic job, this would not have happened without you @lstratman!

@glennblock
Copy link
Collaborator

👍👍👍👍

@pauldotknopf
Copy link

pauldotknopf commented Sep 22, 2016

I notice the README still says "coming soon" for CoreCLR. Is that just out-dated?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants