SlideShare a Scribd company logo
.NET compiler platform
Roslyn
Piotr Benetkiewicz
ais.pl
Agenda
● Introduction, background, history
● Roslyn in new VS 2015
● Syntax API
● Semantics
● Compilation
● Analyzers, Fixes
● Scripting
When, what, why
● .NET compiler platform
● Compiler as a service, csc.exe API
● Started 2008 (PDC, Los Angeles, CA)
● Codeplex -> Github
● Now in beta RC on nuget
● VS 2015
What, when, why cont.
● “Poor” csc architecture
o Different compiler forks for different tasks
o clear C# and VB separation
● C++ vs. .NET languages
Have you ever tried cat food?
What, when, why cont.
.NET compiler platform codename Roslyn
.NET compiler platform codename Roslyn
Roslyn must
● Have great throughput
● Be error insensitive
● Have great sense of error scope
● Support REPL-like scenarios
● be VS-agnostic
Getting started
● VS 2015 CTP6
o watch out for side-by-side installation!
● VS SDK
● Install-Package Microsoft.CodeAnalysis -Pre
● Optional:
o .NET Compiler Platform SDK Templates
o Syntax Visualizer extension
DEMO
Syntax
Syntax cont.
● SyntaxTree - base abstraction, immutable
● Building ST
o from source
o using factory methods
● Navigating ST
o Members and casting
o OfType<>
o CSharpSyntaxWalker
DEMO
Syntax modules are smart
Syntax modules are smart
Semantics
Yesterday a parrot will drive a bitter,
encrypted car.
● english words
● punctuation
● yet it doesn’t make sense…
● binding
Semantics cont.
● Get the real meaning of the abstract content
● Linking to a Symbol
● Needs context:
o user defined (your code!)
o external metadata (ex. mscorlib)
● Reflection on steroids (not at runtime)
o GetSymbolInfo(), GetEnclosingSymbol()
o Control flow analysis
o Can be speculative
Semantics is smart too!
“Property is inaccessible due to its protection level”
● GetSpeculativeSymbolInfo()
● ISymbolInfo.CandidateSymbols
DEMO
Analyzers, code fixes
● VS project templates
● Derive from DiagnosticAnalyzer and apply
DiagnosticAnalyzer attribute
● Derive from CodeFixProvider and apply
ExportCodeFixProvider attribute
● Use “Add analyzer” in VS, nuget or csc.exe
Analyzers, code fixes cont.
DEMO
What to expect after Roslyn ships?
● Better vanilla VS user experience
● Alternative IDEs Editors (OmniSharp)
● Even richer toolset (CI, metrics, diagnostics)
● Scripting (sciptcs)
● Exciting community and commercial projects
o code mutation
o ConfigR
Thank you
● @pbenetkiewicz
● http://benetkiewicz.github.io/blog/
● pbenetkiewicz@gmail.com, piotr@ais.pl

More Related Content

PDF
Test your code
PPTX
React native introduction (Mobile Warsaw)
ODP
Phpactor and VIM
PDF
The Future is Here: ECMAScript 6 in the Wild
PDF
Clang Analyzer Tool Review
PDF
Ruxmon.2013-08.-.CodeBro!
PDF
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
PDF
TDC2016SP - Groovy como você nunca viu
Test your code
React native introduction (Mobile Warsaw)
Phpactor and VIM
The Future is Here: ECMAScript 6 in the Wild
Clang Analyzer Tool Review
Ruxmon.2013-08.-.CodeBro!
JDD 2017: Kotlin for Java developers (Tomasz Kleszczyński)
TDC2016SP - Groovy como você nunca viu

What's hot (18)

PDF
Lightning talk: Kotlin
PDF
The state of Jenkins pipelines or do I still need freestyle jobs
PPTX
Annotation processing
PDF
How to approach building GUIs using PyQT
ODP
Untitled talk at Riviera.rb
PDF
Hands on clang-format
PPTX
TDD in Go with Ginkgo and Gomega
PDF
Angular Vienna - Use React tools for better Angular apps
ODP
2nd presantation
PDF
freeCodeCamp Tokyo meetup 19
PDF
Building End-to-End Apps Using Typescript
PDF
Test Driven Development with PHP
PPTX
Review: Apitrace and Vogl
PPTX
Clang compiler `
PDF
Last Month in PHP - June through Mid-July 2017
PDF
Drupal and testing (2010 - 2011 / 2)
PDF
Building End to-End Web Apps Using TypeScript
PDF
Use React tools for better Angular apps
Lightning talk: Kotlin
The state of Jenkins pipelines or do I still need freestyle jobs
Annotation processing
How to approach building GUIs using PyQT
Untitled talk at Riviera.rb
Hands on clang-format
TDD in Go with Ginkgo and Gomega
Angular Vienna - Use React tools for better Angular apps
2nd presantation
freeCodeCamp Tokyo meetup 19
Building End-to-End Apps Using Typescript
Test Driven Development with PHP
Review: Apitrace and Vogl
Clang compiler `
Last Month in PHP - June through Mid-July 2017
Drupal and testing (2010 - 2011 / 2)
Building End to-End Web Apps Using TypeScript
Use React tools for better Angular apps
Ad

Similar to .NET compiler platform codename Roslyn (20)

PPTX
Creating a reasonable project boilerplate
PDF
Not Your Fathers C - C Application Development In 2016
PDF
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
PDF
How to contribute textual tooling for apache camel in several id es
PPTX
Road to sbt 1.0 paved with server
PPT
Auto cad 2006_api_overview
PDF
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
PPTX
Road to sbt 1.0: Paved with server (2015 Amsterdam)
PDF
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
PDF
Assembly thy Web
PDF
Enforcing API Design Rules for High Quality Code Generation
PDF
PDF
Crystal internals (part 1)
PDF
Crystal internals (part 1)
PDF
Crystal internals (part 1)
PDF
Counterclockwise past present future
PDF
Dot NET Solution Architect Roadmap By Scholarhat PDF
PDF
Introduction to React Native
PPTX
Dmytro Dziubenko "Developer's toolchain"
PDF
Oh the compilers you'll build
Creating a reasonable project boilerplate
Not Your Fathers C - C Application Development In 2016
RESTful Machine Learning with Flask and TensorFlow Serving - Carlo Mazzaferro
How to contribute textual tooling for apache camel in several id es
Road to sbt 1.0 paved with server
Auto cad 2006_api_overview
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Using Automated Code Reviews to Achieve Continuous Quality (ASQF Agile Night ...
Assembly thy Web
Enforcing API Design Rules for High Quality Code Generation
Crystal internals (part 1)
Crystal internals (part 1)
Crystal internals (part 1)
Counterclockwise past present future
Dot NET Solution Architect Roadmap By Scholarhat PDF
Introduction to React Native
Dmytro Dziubenko "Developer's toolchain"
Oh the compilers you'll build
Ad

More from Piotr Benetkiewicz (6)

PDF
Deep dive into Fastly
PPTX
So, you wanna build a SSO
PDF
Introduction to GIT
PPT
Automatic system tests of web applications
PPTX
Linq and Orcas
PPTX
Deep dive into Fastly
So, you wanna build a SSO
Introduction to GIT
Automatic system tests of web applications
Linq and Orcas

Recently uploaded (20)

PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Digital Strategies for Manufacturing Companies
PDF
System and Network Administration Chapter 2
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Nekopoi APK 2025 free lastest update
PDF
medical staffing services at VALiNTRY
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Introduction to Artificial Intelligence
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
history of c programming in notes for students .pptx
Odoo Companies in India – Driving Business Transformation.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
CHAPTER 2 - PM Management and IT Context
Digital Strategies for Manufacturing Companies
System and Network Administration Chapter 2
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PTS Company Brochure 2025 (1).pdf.......
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
How Creative Agencies Leverage Project Management Software.pdf
Understanding Forklifts - TECH EHS Solution
Which alternative to Crystal Reports is best for small or large businesses.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Upgrade and Innovation Strategies for SAP ERP Customers
Nekopoi APK 2025 free lastest update
medical staffing services at VALiNTRY
Operating system designcfffgfgggggggvggggggggg
Introduction to Artificial Intelligence
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
history of c programming in notes for students .pptx

.NET compiler platform codename Roslyn

  • 2. Agenda ● Introduction, background, history ● Roslyn in new VS 2015 ● Syntax API ● Semantics ● Compilation ● Analyzers, Fixes ● Scripting
  • 3. When, what, why ● .NET compiler platform ● Compiler as a service, csc.exe API ● Started 2008 (PDC, Los Angeles, CA) ● Codeplex -> Github ● Now in beta RC on nuget ● VS 2015
  • 4. What, when, why cont. ● “Poor” csc architecture o Different compiler forks for different tasks o clear C# and VB separation ● C++ vs. .NET languages Have you ever tried cat food?
  • 8. Roslyn must ● Have great throughput ● Be error insensitive ● Have great sense of error scope ● Support REPL-like scenarios ● be VS-agnostic
  • 9. Getting started ● VS 2015 CTP6 o watch out for side-by-side installation! ● VS SDK ● Install-Package Microsoft.CodeAnalysis -Pre ● Optional: o .NET Compiler Platform SDK Templates o Syntax Visualizer extension
  • 10. DEMO
  • 12. Syntax cont. ● SyntaxTree - base abstraction, immutable ● Building ST o from source o using factory methods ● Navigating ST o Members and casting o OfType<> o CSharpSyntaxWalker
  • 13. DEMO
  • 16. Semantics Yesterday a parrot will drive a bitter, encrypted car. ● english words ● punctuation ● yet it doesn’t make sense… ● binding
  • 17. Semantics cont. ● Get the real meaning of the abstract content ● Linking to a Symbol ● Needs context: o user defined (your code!) o external metadata (ex. mscorlib) ● Reflection on steroids (not at runtime) o GetSymbolInfo(), GetEnclosingSymbol() o Control flow analysis o Can be speculative
  • 18. Semantics is smart too! “Property is inaccessible due to its protection level” ● GetSpeculativeSymbolInfo() ● ISymbolInfo.CandidateSymbols
  • 19. DEMO
  • 20. Analyzers, code fixes ● VS project templates ● Derive from DiagnosticAnalyzer and apply DiagnosticAnalyzer attribute ● Derive from CodeFixProvider and apply ExportCodeFixProvider attribute ● Use “Add analyzer” in VS, nuget or csc.exe
  • 22. DEMO
  • 23. What to expect after Roslyn ships? ● Better vanilla VS user experience ● Alternative IDEs Editors (OmniSharp) ● Even richer toolset (CI, metrics, diagnostics) ● Scripting (sciptcs) ● Exciting community and commercial projects o code mutation o ConfigR
  • 24. Thank you ● @pbenetkiewicz ● http://benetkiewicz.github.io/blog/ ● pbenetkiewicz@gmail.com, piotr@ais.pl