How can I get Visual Studio to error check my code (show the squiggles) without explicitly compiling?

Peter Recore picture Peter Recore · Jan 20, 2010 · Viewed 11.9k times · Source

I use Visual Studio (C# Express 2008) occasionally to work with some vendor supplied C# code. I am looking to make my experience with VS more like my experience with Eclipse. I have become accustomed to the way Eclipse handles underlining errors (in java source). When I make an error in my code in Eclipse, it will be underlined right away, and if I fix it, the underline will disappear almost immediately, or at worst, when I save the file. In Visual Studio however, the underline remains until I next build the project.

Is there a setting somewhere I can change so that VS will build every time I save, or even as I am typing? Is this hard to do with C# because it is more complex in some way than Java? Do I need to find someone to buy me the full (non express) version? Also, what is the squiggly underline feature called? I fear this question may have been asked before but I don't know the magic word to search for.

Answer

Eric Lippert picture Eric Lippert · Jan 20, 2010

Jason's answer is fine, but a couple additional points:

is this hard to do with C# because it is more complex in some way than Java?

Yes, but that's not relevant. Yes, it is a hard problem to do on-the-fly analysis of any language in the 100 milliseconds between keystrokes. Doing it for C# is probably harder than Java, being that it supports so many more language features than Java.

But our IDE team is a bunch of buff coders who are awesome, so they can handle doing it for C#.

The real issue was that the compiler architecture of C# was not originally designed to do this sort of analysis in realtime; the VB compiler was. And therefore it took rather longer to fix up the semantic analysis engine of the C# compiler to make this feature feasible.

We're continuing to do research into how to rearchitect the compiler to expose more and more of these on-the-fly analysis services in a rich, extensible and compelling way, but this will take some time. It's a big compiler.

what is the squiggly underline feature called?

On the compiler team we call it "the squiggly red underline feature", or "squiggles" for short.

I don't know if marketing has a name for it or not. If they do, it's probably something like "Microsoft SquiggleSense .NET For The Microsoft Visual Studio Suite System 2008"; they seem to like these long names that have "Microsoft" in them twice.