Slide 1

Slide 1 text

Open Source .NET technology explained Atsushi Eno (atsushieno/@atsushi_eno) goo.gl/0hxxIT

Slide 2

Slide 2 text

/me ● Mono project developer, .NET Core contributor ● Software engineer at Xamarin ● lurking around H4 and TOSSUG (when in Taipei)

Slide 3

Slide 3 text

my COSCUP sessions on OSS & .NET ● 2013: MonoDevelop IDE ○ how the IDE works. ● 2014: Mono and Open Source .NET ○ how Mono is made up with OSS-ed .NET parts ● 2015: .NET Core ○ what .NET Core is, how it works. (meh, the topics are getting bloat...)

Slide 4

Slide 4 text

Agenda ● The situation how .NET Core was born ● See how .NET Core works ● Current .NET Core status and visions

Slide 5

Slide 5 text

Quick intro to .NET Framework ● A complete development platform (like Java) ○ ECMA 335 (CLI) high-level VM, statically-typed system (similar to jvm) foundation class libraries (similar to rt.jar) beyond standards: DB, Web, GUI... well-thought assembly (library) versioning support ○ ECMA 334 (C#) statically-typed compilers (similar to java)

Slide 6

Slide 6 text

what is .NET dev. experience like? ● mostly awesome ○ solid and mature framework libraries ○ C# is stable yet evolving ○ the IDE (Visual Studio) experience is supreme

Slide 7

Slide 7 text

is .NET perfect then? ● NO! NO! NO! ○ it's not quite handy, need to install .NET Fx ○ apps easily become Windows-only ○ too much of Windows-isms ○ too many framwork variants, hard to support all ○ .NET Fx development is getting slow ○ updatable only in sync with Windows or VS releases. ○ several issues due to closed source

Slide 8

Slide 8 text

Wait, I heard that .NET is cross platform... Yes we are cross platform!

Slide 9

Slide 9 text

There is Mono, it is truly x-plat Mono complements .NET defects ● cross platform ● open source ● non-Windows native API Also, Microsoft friendly Problems ● not (meant to be) fully compatible w/ .NET Fx ● not actively developing server stack anymore ● Xamarin went mobiles, leaving Linux desktop

Slide 10

Slide 10 text

x-plat ain't easy ● SL, WP, StoreApp, Xamarin ... different Fx and versions ○ because everything cannot be implemented everywhere ○ You cannot reference Desktop assemblies in those frameworks ○ Normally libraries need to be built for those platforms ● PCL (Portable Class Library) makes it easy ○ you build your library as a PCL project ○ PCLs can be referenced by any (of the profile targets) ○ For PCLs, you specify Profile, not dll references ○ packages via NuGet.org (zip archive of dlls, resources and tools)

Slide 11

Slide 11 text

How is PCL support implemented? (briefly) ● modularized core libraries ○ so each Profile is represented as a set of feature assemblies ● Type forwarding ○ PCL "Facade" assemblies don't have implementation ○ instead, they have [TypeForwardedTo] attributes.

Slide 12

Slide 12 text

ASP.NET evolution ● Web Forms o very easy (even for VB coders) x integration with external JavaScript was horrible ASP.NET Ajax ● MVC o that's what normal Web dev. wanted. o started as an OSS project, and extended OSS-ism. x depends on System.Web

Slide 13

Slide 13 text

What's wrong with System.Web? ● part of .NET Fx - hard to upgrade ● Web dev. trends need low-level support ○ non-blocking I/O (libuv) ○ HTTP/2 ● needs updatable lightweight deployment framework

Slide 14

Slide 14 text

● "Introducing .NET Core" (.NET team blog) ● portable subset of .NET Fx ● sort out all of those known issues ○ MIT license w/ patent covenant ○ standalone redist-able, per app ○ x-plat ● release stages: src(git)/pkg/Fx the rise of .NET Core

Slide 15

Slide 15 text

.NET Core components (briefly) ● coreclr - runtime (VM) ● roslyn - C# compiler ● corefx - foundation class libraries ● aspnet - web app framework

Slide 16

Slide 16 text

----

Slide 17

Slide 17 text

Running .NET Core ● Use "DNX SDK" (dnvm) ○ installer https://github.com/dotnet/coreclr#get-net-core or Docker ○ ... or manually set up everything (complicated) ● app files: (C#) sources, package.json (project config) ● Run ○ set up dnvm (dnvm: runtime configurator; see coreclr docs) like update-alternatives ○ dnu restore (dnu: package resolver) ○ dnx (-p) . run (dnx: runtime, -p is very new option) ○ dnvm install 1.0.0-beta7-12275 -r coreclr -u; dnvm install 1.0.0-beta7-12275 -u; dnu restore; dnvm use 1.0.0-beta7-12275 -r coreclr; dnx . run

Slide 18

Slide 18 text

Running .NET Core ● How things work ○ dnvm (framework/selector) ■ the Fx runtime backend can be: clr, mono, coreclr ○ dnu (package resolver) ■ based on nuget ○ dnx (runtime) ■ uses roslyn (compiler) to compile app at run time

Slide 19

Slide 19 text

Building .NET Core (Well, you can build them, but managing everything to run app is messy.) ● coreclr runtime ○ you need Windows to build mscorlib.dll ○ or, some people offer precompiled ones ○ or, use my patched build that partially works (PR1275) ● corefx classlibs ○ builds on Linux/Mac/Win (often fails outside Windows) ○ still lacks PCL Facades - need to download binaries (dnu restore) ● roslyn compiler ○ Windows for full build, or partial x-plat build

Slide 20

Slide 20 text

----

Slide 21

Slide 21 text

coreclr ● .NET Core runtime (VM) ○ Rotor (SSCLI) -> Silverlight (on Mac) -> this ○ EE (execution engine) , GC, native interop, JIT, debugging ○ mscorlib.dll (as it is tightly-coupled with the VM) ○ architecture docs for hackers: Book of the Runtime (BotR), CoreCLR Coding Guide (in the github repo) but you would be just happy with existing .NET readings, they are so advanced...

Slide 22

Slide 22 text

corefx ● managed class libraries ● subset of .NET FCL ○ StoreApp/Silverlight/Phone, excluding UI, Plat-specific ○ Not fully done, see corefx-progress repo

Slide 23

Slide 23 text

roslyn ● compiler infrastructure: compilers + "services" ○ => my COSCUP2013 slides ○ Used by VS2015, MonoDevelop6 and "omnisharp" ● managed C#/VB compiler implementation ○ easy to extend by .NET devs ● debug symbols are getting portable (PPDB - very new)

Slide 24

Slide 24 text

aspnet ● The revamped ASP.NET. ○ decomposed System.Web into many packages ○ cross platform from scratch. ■ app runtime: dnx (so, clr/mono/coreclr) ■ server: IIS (Helios), libuv (Kestrel), self-host (WebListener) ○ own packaging / dependency system: dnu ■ Hosting, Mvc, SignalR, Identity, EntityFramework, ... ○ dynamic compilation using Roslyn (as dnx does)

Slide 25

Slide 25 text

related: referencesource ● incomplete sources for .NET Framework (not .NET Core) ● It is mostly for Mono project ○ so that Mono can import it, for improved compatiblity. ○ Mono is importing them, but cannot simply replace. ■ remove Windows-isms, mobile restrictions etc.

Slide 26

Slide 26 text

related: msbuild ● MSBuild is needed to build .NET Core themselves. ● Needed for cross platform build. ○ Mono implementation (xbuild) is old and incomplete. ● getting x-plat ready now.

Slide 27

Slide 27 text

related: llilc ● Another JIT implementation for coreclr ○ JIT = native executable code generator ○ coreclr JIT is pluggable (can be replaced) ● JIT implementation trend: use LLVM native codegen ○ to support as many platforms as LLVM supports. ● llilc: coreclr JIT implementation using LLVM ● under development yet

Slide 28

Slide 28 text

related: Visual Studio Code ● NOT open source (yet?) ● Cross platform IDE for .NET Core ● Very simple IDE. Just an enhanced code editor + debugger ○ But what is an "IDE" ? >> my COSCUP2013 slides ● built upon Electron (Atom Shell) ● supports C# and TypeScript (TS has language service)

Slide 29

Slide 29 text

----

Slide 30

Slide 30 text

the state of .NET Core ● .NET Core: the future .NET platform (i.e. not now) ○ .NET Framework etc. will be based on it. ● code status ○ coreclr - Windows dependencies in the build system ○ corefx - more porting work needed ○ no integrated build/installs. ○ builds are not stable yet. Builds on CI servers are almost fake. ● ASP.NET - on its own roadmap

Slide 31

Slide 31 text

the state of Mono ● is Mono still needed? ○ cross platform is still big TODO at .NET Core. ○ There is mono ecosystem (Gtk# and apps) ○ so as Xamarin platforms ● Mono visions ○ import more referencesource for .NET compatibility ○ reuse good coreclr parts (e.g. GC)

Slide 32

Slide 32 text

How can you benefit from .NET Core? ● For now if you just write apps, use .NET Framework etc. ! ● You can understand the underlying Fx you use better. ● You can build and ship app with your own .NET Core build. ○ ship with fixed version of .NET Core ○ modify the Fx behavior to fit your app's need. ● You can research how the modern dev. framework works.

Slide 33

Slide 33 text

.NET Core: Possible use cases ● Learn from what Mono has done in the past ● Hosting CoreCLR ○ Office.NET, CLI-UNO (LibreOffice) ○ SQLCLR ○ Unity3D etc. ● Develop another .NET based framework? ○ Browser plugin? (Silverlight/Moonlight => WebAssembly) ○ IoT? (.NET Micro Framework) ○ new mobile platforms? (Xamarin)

Slide 34

Slide 34 text

developing (contributing to) .NET Core ● .NET Core hosted at github. They accept PRs. ○ Cup ● still not easy to try integration tests with private hacks...

Slide 35

Slide 35 text

----

Slide 36

Slide 36 text

Summary

Slide 37

Slide 37 text

Lastly... Anyone interested in .NET Core dev group? Let me know

Slide 38

Slide 38 text

Thanks