Upload
rodolfo-finochietti
View
2.555
Download
2
Embed Size (px)
DESCRIPTION
Novedades en la plataforma de desarrollo Microsoft para 2014: C#, Roslyn y ASP.NET vNext
Citation preview
ASP.NET vNextC# vNext
Mariano SanchezMarcos TorresRodolfo Finochietti (MVP)
Evolución
Roslyn y el futuro de C#
Agenda
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
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
Roslyn – .NET Compiler PlatformCompleta reescritura de los compiladores C# y Visual BasicOpen Source!
Language ServicesCode Analysis APIsExtensibilidadRead-Eval-Print-Loop (REPL)Scripting
CompilerSí, una caja negra
?class Program{ void Main() { }} ▫
program.exe
CSC - VBC
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
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
Workspace APIHost Environment
Workspace
Solution
Project Project
Document
Document
Solution2 Solutionn
Apply
Edit Edit
SyntaxTree
Compilation
Events (e.g. key presses)
Syntax Tree API – NodesCompilationUnit
TypeDeclaration
MethodDeclaration
class C{ void M() { }}// C▫
ParameterList
Block
var tree = CSharpSyntaxTree.ParseText("...");
Syntax Tree API – TokensCompilationUnit
TypeDeclaration
class
C {MethodDeclaratio
n}
EOF
void MParameterLi
stBlock
( ) { }
class C{ void M() { }}// C▫
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▫
Syntax Tree APICompilationUnit
TypeDeclaration
class
C {MethodDeclaratio
n}
EOF
void MParameterLi
stBlock
( ) { }
class C{ void M() { }}// C▫
Syntax Tree APICompilationUnit
TypeDeclaration
class
C {MethodDeclaratio
n}
EOF
void MParameterLi
stBlock
( ) { }
class C{ void M(int x) { }}// C▫
Syntax Tree APICompilationUnit
TypeDeclaration
class
C {MethodDeclaratio
n}
EOF
void MParameterLi
stBlock
( ) { }Parameter
int
xPredefinedTyp
e
class C{ void M(int x) { }}// C▫
C# 6
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); }}
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);
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");}
Referenciashttp://roslyn.codeplex.comSchabse Laks Roslyn articles:
Alex Turner Tech Days 2012 Slides Compiler API / Syntax Tree API
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
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”
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
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
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
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
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
Modern Web – Cloud
Cloud readyConfiguration
Session
CacheDiagnostics
Run/Debug in CloudTracing/Logging without re-deploy
Seamless transition from on-premises to cloud
Modern Web – Cross Platform
EditorsVisual Studio, Text, Cloud editors
No editors (command line)
Open Source with Contributions
RuntimeWindows, Mac, Linux
OSS
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
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)
.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
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