Code Monkey home page Code Monkey logo

dna-redux's Introduction

dna-redux

Playground for running C#/F# code in Node.js, Browsers or Native (x86/ARM).

  • The CIL is running in a portable .NET runtime called DotNetAnywhere (DNA).
  • For Node.js/Browser targets it's compiled to WebAssembly with Emscripten.

Based on the excellent works of:

Features:

  • Supports both C# and F#.
  • Runs in Node.js, Browsers or Native (x86/ARM).
  • Uses .NET Core 2.0 (targeting netstandard1.3 and above).
  • the BCL (corlib) implementation is somewhat minimal.

Changes vs stock DNA/Blazor:

  • added F# support.
  • Performance updates.
  • JIT updates and fixes.
  • corlib updates and fixes.
  • JavaScript interop updates.
  • Razor/SPA removed for clarity.

Disclaimer:

  • This is just an experiment to see how far can this be taken without too much effort and what the performance looks like. Obviously it would be nice to have faster GC or highly optimized JIT like RyuJIT to target WebAssembly, but you can still have fun with this now and see what the future of web development may look like.

Building:

  • dotnet build && npm install && npm run build
  • or just use build.cmd to build, VS Code to edit/run.

Running:

  • Running in Node.js: npm start

  • Running in Browser: npm run server to start a web server, then go to localhost:5000 (hint: look in the Console output)

  • Running as Native: see src/DNA/native

  • You can run it in VS Code, just select a debug config and hit F5.

  • The C#, C/C++, Ionide-fsharp, Debugger for Chrome and TSLint extensions for VS Code are highly recommended, but optional.

Further reading:

dna-redux's People

Contributors

eloraiby avatar ncave 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

Watchers

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

dna-redux's Issues

instructions?

Are there instructions for building, running and extending?

For context, I'm interested in playing around with this project as an extension of Blazor and also because I'm unable to get the Blazor source to run on a box with VS2017 15.4. Thoughts about the latter would be appreciated as well.

Adding 64-bit support

When running on x64 it crashes in Type_Init(), while loading corelib.dll. After investigating the source of the problem is the pointer size being hard-coded to 4.

This particular problem (loading an assembly) originating source is the MetaData.c file:
tableDefs and LoadSingleTable.

Error in sprintf with more than 3 parameters

Using sprintf with more than 3 parameters leads to a crash due to a bad heap pointer.

  • Only happens when the Fsharp.Core is compiled in release mode, works fine in debug mode.
  • printf works fine in either release or debug, with any number of parameters.
  • Possibly related to delegate invocation

error building FSharp.Core

on Windows, I get the following error when building using build.cmd:

Time Elapsed 00:00:01.79
  Restoring packages for D:\Projects\dotnet-js\src\FSharp.Core\FSharp.Core.fsproj...
  Generating MSBuild file D:\Projects\dotnet-js\src\FSharp.Core\obj\FSharp.Core.fsproj.nuget.g.props.
  Generating MSBuild file D:\Projects\dotnet-js\src\FSharp.Core\obj\FSharp.Core.fsproj.nuget.g.targets.
  Writing lock file to disk. Path: D:\Projects\dotnet-js\src\FSharp.Core\obj\project.assets.json
  Restore completed in 485.64 ms for D:\Projects\dotnet-js\src\FSharp.Core\FSharp.Core.fsproj.

  NuGet Config files used:
      C:\Users\Wael\AppData\Roaming\NuGet\NuGet.Config
      C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

  Feeds used:
      https://api.nuget.org/v3/index.json
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Microsoft (R) Build Engine version 15.1.1012.6693
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files\dotnet\sdk\1.0.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets(165,5): error : Duplicate 'Compile' items were included. The .NET SDK includes 'Compile' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultCompileItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The duplicate items were: 'array.fs'; 'array.fsi'; 'array2.fs'; 'array2.fsi'; 'array3.fs'; 'array3.fsi'; 'collections.fs'; 'collections.fsi'; 'event.fs'; 'event.fsi'; 'fslib-extra-pervasives.fs'; 'fslib-extra-pervasives.fsi'; 'Linq.fs'; 'Linq.fsi'; 'list.fs'; 'list.fsi'; 'local.fs'; 'local.fsi'; 'map.fs'; 'map.fsi'; 'MutableTuple.fs'; 'nativeptr.fs'; 'nativeptr.fsi'; 'option.fs'; 'option.fsi'; prim-types-prelude.fs'; 'prim-types-prelude.fsi'; 'prim-types.fs'; 'prim-types.fsi'; 'printf.fs'; 'printf.fsi'; 'QueryExtensions.fs'; 'quotations.fs'; 'quotations.fsi'; 'reflect.fs'; 'reflect.fsi'; 'result.fs'; 'result.fsi'; 'seq.fs'; seq.fsi'; 'seqcore.fs'; 'seqcore.fsi'; 'set.fs'; 'set.fsi'; 'SI.fs'; 'string.fs'; 'string.fsi' [D:\Projects\dotnet-js\srcFSharp.Core\FSharp.Core.fsproj]

Build FAILED.

C:\Program Files\dotnet\sdk\1.0.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets(165,5): error : Duplicate 'Compile' items were included. The .NET SDK includes 'Compile' items from your project directory by default. You can either remove these items from your project file, or set the 'EnableDefaultCompileItems' property to 'false' if you want to explicitly include them in your project file. For more information, see https://aka.ms/sdkimplicititems. The du
plicate items were: 'array.fs'; 'array.fsi'; 'array2.fs'; 'array2.fsi'; 'array3.fs'; 'array3.fsi'; 'collections.fs'; 'collections.fsi'; 'event.fs'; 'event.fsi'; 'fslib-extra-pervasives.fs'; 'fslib-extra-pervasives.fsi'; 'Linq.fs'; 'Linq.fsi'; 'list.fs'; 'list.fsi'; 'local.fs'; 'local.fsi'; 'map.fs'; 'map.fsi'; 'MutableTuple.fs'; 'nativeptr.fs'; 'nativeptr.fsi'; 'option.fs'; 'option.fsi'; 'prim-types-prelude.fs'; 'prim-types-prelude.fsi'; 'prim-types.fs'; 'prim-types.fsi'; 'printf.fs'; 'printf.fsi'; 'QueryExtensions.fs'; 'quotations.fs'; 'quotations.fsi'; 'reflect.fs'; 'reflect.fsi'; 'result.fs'; 'result.fsi';'seq.fs'; 'seq.fsi'; 'seqcore.fs'; 'seqcore.fsi'; 'set.fs'; 'set.fsi'; 'SI.fs'; 'string.fs'; 'string.fsi' [D:\Projects\dotnet-js\src\FSharp.Core\FSharp.Core.fsproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.25
---
Build failed

segfaults on ARM32 (armv7a)

@ncave building DNA on armv7a (native) and running helloworld.dll would segfault. An F# hello world application on ARM would run if System.Console.WriteLine is used, but printfn will segfault when writing a string (unrelated to missing CustomAttributeData). Have you been able to run it on ARM ?

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.