Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

behavior of background compiler in visual studio 2015

I am using the preview of visual studio 2015 (v14) to write some C# and I have been wondering what the background compiler actually does. From my understanding it checks the state of the code editor and is smart enough to know when I stop editing for some milliseconds and then takes the opportunity to compile it and present the errors/warnings.

I though that if edit part of code in a large code base and with lots of dependencies (many other parts depend on that particular piece of code), the compile time of the background compiler would increase. But whether it is the above case or just a simple hello world console app, the compile time is pretty much constant, ~2 seconds on my machine.

Obviously the compiler doesn't do a full re-build of everything, but how does it do it? Which part of the Roslyn API is used? Is there some article out there explaining this? Have searched but found nothing.

like image 759
Mr Balanikas Avatar asked Oct 20 '22 19:10

Mr Balanikas


1 Answers

The background compiler uses Roslyn to get the semantic model for the syntax tree backed by your document, and runs Roslyn's diagnostics to report errors and warnings.

It doesn't touch other code that depends on your file.

like image 123
SLaks Avatar answered Nov 11 '22 19:11

SLaks