Background compiler behavior in visual studio 2015

I am using visual studio 2015 (v14) preview to write some C #, and I was wondering what the background compiler does. In my opinion, it checks the status of the code editor and is smart enough to know when I stop editing for a few milliseconds, and then takes the opportunity to compile it and present errors / warnings.

I though, if you edit part of the code in a large code base and with a lot of dependencies (many other parts depend on this particular part of the code), the compiler time for the background compiler will increase. But regardless of whether this is the aforementioned case or just a simple hello world console application, the compilation time is pretty much constant, ~ 2 seconds on my machine.

Obviously, the compiler does not completely rebuild everything, but how does it do it? What part of the Roslyn API is used? Is there any article explaining this? They searched, but found nothing.

+5
source share
1 answer

The background compiler uses Roslyn to obtain a semantic model for the syntax tree supported by your document, and runs Roslyn diagnostics to report errors and warnings.

It does not apply to other code that depends on your file.

+3
source

Source: https://habr.com/ru/post/1210403/


All Articles