For most of us the important question about compliers is “what’s the difference between compiler and an interpreter?” Bingo! I got the right answer for that. Compilers have been a black box magic to me and I always wanted to be Jadugar who actually revealed it. Unfortunately, all the efforts failed when Visual studio was thrown before me. All I do now is press F5 or Ctrl F5. My eyes only lit up when I see “BUILD SUCCESSFUL” comment. It’s what we all love to see. When build successful appears we know half of our project is done.

Currently, Microsoft is actually making some modifications. Being a Microsoft programmer, I am glad to know about the recent announcement in tech ed, a new liner to add in my resume (let’s assume we see light at the end of the tunnel). Interestingly, the new Roslyn compiler has a new tag – Compiler AS a Service which implies that you can create your own compiler API. To add more spice, this is an Open Source. The journey to reveal the magic starts here…

First let’s revisit the compilation of asp.net applications. Project compilation and run-time compilation are the 2 w.r.t to asp.net.

PROJECT COMPILATION

  • Project system approach. Basically your .csproj file.
  • Takes place in VS using MS build
  • After compilation the assembly is put in bin folder of your project
  • This assembly is deployed the server and loaded using asp.net run-time when you request your application to start
  • Assets such as page, user control, handler code-behind classes, controllers and embedded resources are built using project compilation
  • Typically the source code for these assets is not deployed to the server. Other asset types, including .aspx, .ascx, .ashx, .cshtml, and .vbhtml, are deployed to the server and built by the ASP.NET runtime itself using runtime compilation

RUN TIME COMPILATION

  • Compiles your application’s assets on the server when your application is running
  • Page assets such as .aspx, .ascx, .ashx, .cshtml, and .vbhtm are parsed and turned into codedom
  • The code dom graph is formed using the code dom provider
  • C# code is compiled into an assembly usign the code dom provider
  • The assembly is loaded into the application when it is started and it is also cached to your disk (Asp.Net temp folder)

Well! It’s the tradition of compilers which I know is hard to follow and never binds into us. Hence the name, Black Magic.

The upcoming generation of ROSLYN compilers drew me in with one phrase which said you can write your own code analysis engine for C# with the roslyn compilers APIs. You can read that twice if you don’t believe it. To ground down building your IDE is what it promises.

  • Increasingly we rely on integrated development environment (IDE) features such as
    IntelliSense, refactoring, intelligent rename, “Find all references,” and “Go to definition”to increase our productivity
  • We rely on code analysis tools to improve our code quality and code generators to aid in application construction
    This is the core mission of the .NET Compiler Platform (“Roslyn”): opening up the black boxes and allowing tools and end users to share in the wealth of information compilers have about our code. Instead of being opaque source-code-in and object-code-out translators, through the .NET Compiler Platform (“Roslyn”), compilers become platforms—APIs that you can use for code related tasks in your tools and application.

I will take you through in-built features of the Roslyn compilers in my next post which you can find it by clicking here.

 

Tags: Roslyn Compiler | Comments Off

previous post: Features of ASP .NET vNEXT next post: Roslyn Compilers – Asp.net Vnext Feature

Comments are closed.

Archives

2016
2015
2014
2013
2012
Congruent Facebook Twitter Slideshare