36
ASP.NET vNext C# vNext Mariano Sanchez Marcos Torres Rodolfo Finochietti (MVP)

Microsoft 2014 Dev Plataform - Roslyn -& ASP.NET vNext

Embed Size (px)

DESCRIPTION

Novedades en la plataforma de desarrollo Microsoft para 2014: C#, Roslyn y ASP.NET vNext

Citation preview

Page 1: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

ASP.NET vNextC# vNext

Mariano SanchezMarcos TorresRodolfo Finochietti (MVP)

Page 2: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Evolución

Page 3: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Roslyn y el futuro de C#

Page 4: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Agenda

Page 5: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

AgendaRoslyn: Qué es? Propósito y objetivosAPIs del Compilador expuestas por RoslynNuevas posibilidades en la mejora y análisis de código en C# y Visual BasicCaracterísticas de C# 6.0Evolución

Page 6: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Innovation in .NET ecosystem: //BUILD 2014

Core .NET

Next gen JIT (“RyuJIT”)

SIMD

Runtime Compilers .NET Compiler Platform (“Roslyn”)

Languages innovation

Windows Desktop

Azure and Windows Server

Universal projects

.NET NativeASP.NET updates

Windows Convergence

Native compilation

Cross-devices

Xamarin partnership

Web apps

.NET support for Azure Mobile Services

Cloud Services

Openness

Windows Store iOS and Android

.NET in devices and services

Page 7: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Roslyn – .NET Compiler PlatformCompleta reescritura de los compiladores C# y Visual BasicOpen Source!

Language ServicesCode Analysis APIsExtensibilidadRead-Eval-Print-Loop (REPL)Scripting

Page 8: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

CompilerSí, una caja negra

?class Program{ void Main() { }} ▫

program.exe

CSC - VBC

Page 9: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Symbol API

Roslyn APIsLanguage Service

Compiler API

Compiler Pipeline

Syntax Tree API

Binding and Flow Analysis APIs

Emit API

Form

atte

r

Colo

rizer

Ou

tlinin

g

Navig

ate

To

Ob

ject

Bro

wse

r

Com

ple

tion

List

Find

All

Refe

ren

ces

Ren

am

e

Qu

ick Info

Sig

natu

re

Help

Extra

ct M

eth

od

Go To

D

efin

ition

Ed

it an

d

Con

tinu

e

ParserMetadata

Import

Binder IL EmitterSymbols

Page 10: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Symbol API

Roslyn API Layers

Services

Compiler Syntax Tree API

Binding and Flow Analysis

APIs

Emit API

Scripting API

Workspace API

Code FormattingFind All

ReferencesName

Simplification …

Editor Services

Code Actions Classification Completion …Outlining

Page 11: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Workspace APIHost Environment

Workspace

Solution

Project Project

Document

Document

Solution2 Solutionn

Apply

Edit Edit

SyntaxTree

Compilation

Events (e.g. key presses)

Page 12: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Syntax Tree API – NodesCompilationUnit

TypeDeclaration

MethodDeclaration

class C{ void M() { }}// C▫

ParameterList

Block

var tree = CSharpSyntaxTree.ParseText("...");

Page 13: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Syntax Tree API – TokensCompilationUnit

TypeDeclaration

class

C {MethodDeclaratio

n}

EOF

void MParameterLi

stBlock

( ) { }

class C{ void M() { }}// C▫

Page 14: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Syntax Tree API – “Trivia”CompilationUnit

TypeDeclaration

class

C {MethodDeclaratio

n}

EOF

void MParameterLi

stBlock

( )

{ }

SP EOL EOL // C

SPx4 SP

EOL

EOL

EOLSPx4 EOL SPx4

class∙C{∙∙∙∙void∙M()∙∙∙∙{∙∙∙∙}}// C▫

Page 15: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Syntax Tree APICompilationUnit

TypeDeclaration

class

C {MethodDeclaratio

n}

EOF

void MParameterLi

stBlock

( ) { }

class C{ void M() { }}// C▫

Page 16: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Syntax Tree APICompilationUnit

TypeDeclaration

class

C {MethodDeclaratio

n}

EOF

void MParameterLi

stBlock

( ) { }

class C{ void M(int x) { }}// C▫

Page 17: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Syntax Tree APICompilationUnit

TypeDeclaration

class

C {MethodDeclaratio

n}

EOF

void MParameterLi

stBlock

( ) { }Parameter

int

xPredefinedTyp

e

class C{ void M(int x) { }}// C▫

Page 18: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

C# 6

Page 19: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Primary ConstructorAuto-Property Initializerpublic class Point(int x, int y){ public int X { get; } = x; public int Y { get; } = y; public double R { get; } = Math.Sqrt(x ^ x + y ^ y);

public Point() : this(0, 0) { }

public override string ToString() { return string.Format("({0},{1},{2})", X, Y, R); }}

Page 20: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Null propagating operator associativityvar x = a?.b.c;//left associativevar x = ((var tmp = a) == null ? null : tmp.b).c;var x = a?.b?.c; //Changos!(var tmp = a) == null ? null : tmp.b.c);

var x = a?.b.c;

//right associativevar x = ((var tmp = a) == null ? null : tmp.b.c);Console.WriteLine(args.FirstOrDefault()?.Length ?? 0);

Page 21: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Exception Filteringtry{

Task[] tasks = new Task[10]; for (int i = 0; i < 10; i++) { tasks[i] = Task.Factory.StartNew(() => DoSomeWork(10000000)); } var res = await Task.WhenAll(tasks);}catch (AggregateException e) if (e.InnerExceptions.Count > 2){

await WriteStatus(“filtered exception");}finally{

await WriteStatus(“finished");}

Page 22: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Referenciashttp://roslyn.codeplex.comSchabse Laks Roslyn articles:

Alex Turner Tech Days 2012 Slides Compiler API / Syntax Tree API

Page 23: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

ASP.NET vNext

Page 24: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

active installs of .NET

1.8B

.NET professional developers6

M

From 64k embedded systems, PCs, tablets, phones, up to

and past 64-way Cloud Servers

Page 25: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

What we are hearing from customers“Our role is more important than ever before”

“We are required to innovate and deliver much faster”

“I need a cross-device development strategy”

“Open Source enriches the platform and the community

“…but I have existing applications to run and evolve”

Page 26: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Innovation at the core for your existing and future applications

Continuous modular releases

Transparent, open and community driven

.NET innovation

Flexibility and agile delivery

Openness

Our new approach to building .NET

OSS

.NET

Page 27: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Openness

Community

Rapid innovation

The .NET Foundation

.NET API for Hadoop WebClient

.NET Compiler Platform ("Roslyn").NET Map Reduce API for Hadoop

.NET Micro Framework

ASP.NET MVCASP.NET Web API

ASP.NET Web Pages

ASP.NET SignalR

Composition (MEF2)

Entity Framework

Linq to Hive

MEF (Managed Extensibility Framework)

OWIN Authentication Middleware

Rx (Reactive Extensions)

Web Protection Library

Windows Azure .NET SDK

Windows Phone Toolkit

WnsRecipe

Mimekit Xamarin.Auth

Xamarin.Mobile

Couchbase for .NET

Join the conversation with the

community http://www.dotnetfoundation.org@dotnetfdn // #dotnetfdn

Mailkit

System.Drawing

Page 28: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

ASP.NET vNext and the Modern Web

Choose your Editors and Tools

Open Source with Contributions Cross-PlatformOSS

Seamless transition from on-premises to cloud

Faster Development CycleTotally Modular

Fast

Page 29: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Modern Web – Agility

Faster Development CycleFeatures are shipped as packages

Framework ships as part of the application

More ControlZero day security bugs patched by Microsoft

Same code runs in development and production

Developer opts into new versions, allowing breaking changes

Page 30: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Modern Web - Fast

Runtime PerformanceFaster startup times

Lower memory / higher density (> 90% reduction)

Modular, opt into just features needed

Use a raw socket, framework or bothDevelopment productivity and low frictionEdit code and refresh browserFlexibility of dynamic environment with the power of .NETDevelop with Visual Studio, third party and cloud editors

Page 31: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Modern Web – Cloud

Cloud readyConfiguration

Session

CacheDiagnostics

Run/Debug in CloudTracing/Logging without re-deploy

Seamless transition from on-premises to cloud

Page 32: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Modern Web – Cross Platform

EditorsVisual Studio, Text, Cloud editors

No editors (command line)

Open Source with Contributions

RuntimeWindows, Mac, Linux

OSS

Page 33: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

ASP.NET vNext - Summary

Feature .NET vNext

.NET vNext (Cloud Optimized)

Cloud Ready * *

Modular Design * *

Dependency Injection * *

Consistent Tracing / Debugging * *

Faster Development (No Build Step) * *

Open Source * *

Full Side by Side (framework deployed inside application)

*

Fast startup, Low memory / High throughput (best of class)

*

MVC, Web API, Web Pages 6, SignalR 3, EF 7

Page 34: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

ASP.NET vNext - Compatibility• Web Forms, MVC 5, Web API 2, Web Pages 3, SignalR 2,

EF 6 Fully supported on .NET vNext

• MVC, Web API, Web Pages 6, SignalR 3, EF 7 Breaking changes:

New project system New configuration system MVC / Web API / Web Pages merge No System.Web, new lightweight HttpContext (not

System.Net.Http)

• .NET vNext (Cloud Optimized) Subset of the .NET vNext Framework

Things you depend on might not be available yet (images, etc)

Page 35: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

.NETvNext Web and services

Future of .NET

Device optimized Native compilation Small footprint, side-by-side Cross-device enabled

Cloud optimized High throughput Small footprint, side-by-side Cross-platform enabled

Windows Store, WPF, Windows Forms, Console apps and related libraries.

ASP.NET vNext: Web Forms, MVC, Web Pages, Web API, SignalRWCF

Client apps

Next gen JIT (“RyuJIT”)

SIMD (Data Parallelization)

Runtime

Compilers.NET Compiler Platform (“Roslyn”)

Languages innovationBCL and PCLEntity Framework

Libraries

Common

Openness

Multi-purpose

Specialized

Page 36: Microsoft 2014 Dev Plataform -  Roslyn -& ASP.NET vNext

Summary

Platform Framework Tools

Providing the best end-to-end development experience…

…on your terms

…or bring your own …or bring your own …or bring your own