How can I get Visual Studio to erroneously check my code (show squiggles) without explicit compilation?

I sometimes use Visual Studio (C # Express 2008) to work with the C # vendor code provided by the provider. I want my experience with VS to be more like my experience with Eclipse. I'm used to how Eclipse handles underlining errors (in a java source). When I make a mistake in my code in Eclipse, it will be immediately underlined, and if I fix it, the underline will disappear almost immediately or, in the worst case, when saving the file. However, in Visual Studio, the underline remains until I build the project.

Is there a parameter somewhere that I can change so that VS builds every time I save, or even when I print? Is it hard to do with C # because it is more complicated than Java? Do I need to find someone to buy me a full (non-express version)? Also, what is the squiggly underscore function called? I am afraid that this question may have been asked before, but I do not know the magic word for the search.

+4
source share
4 answers

Do you have Visual C # 2008 Express Edition Service Pack 1 (SP1)? SP1 added exactly this feature in Visual Studio 2008 Professional and Visual C # 2008 Express Edition.

From the release note :

This service pack adds a new Visual C # IDE feature that provides a richer set of error information for your code. In particular, this function represents expression-level errors that appear in open files to you according to your code. These expression level errors were previously reported only after the build operation.

From Scott Guthrie Release Notes :

The C # code editor now identifies and displays red squiggle errors for many semantic code problems that previously required explicit compilation for identification. For example, if you try to declare and use an unknown type in the C # code editor today, you will not see a compilation error until you complete the build. Now with SP1, you will immediately see direct red squiggle errors (no explicit compiler is required):

alt text

+13
source

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

Is this hard to do with C # because it is more complicated than Java?

Yes, but this is not relevant. Yes, the challenge is to “on the fly” analyze any language in 100 milliseconds between keystrokes. Doing this for C # is probably more complicated than Java, as it supports much more language features than Java.

But our IDE team is a bunch of code buffs that are awesome, so they can handle this for C #.

The real problem was that the C # compiler architecture was not originally designed for this kind of real-time analysis; was a VB compiler. And so it took a lot more time to fix the semantic analysis mechanism of the C # compiler to make this possibility feasible.

We continue to explore how to rebuild the compiler to expose more and more of these on-the-fly analysis services in a rich, extensible and compelling way, but it will take some time. This is a great compiler.

What is the squiggly underscore function?

In the compiler command, we call this “reddish underline,” or “squiggles” for short.

I do not know if he has a name for sale or not. If they do, it is probably something like "Microsoft SquiggleSense.NET for Microsoft Visual Studio Suite System 2008"; they seem to like these long names that have "Microsoft" in them.

+16
source

To enable this option in VS 2010, use Tools> Options> Text Editor> C #> Advanced> Show Live Semantic Errors and

VS 2010 use Tools> Options> Text editor> C #> Advanced> Enter selection mode when opening files

+7
source

To enable this option in VS 2010 , use Tools > Options > Text Editor > C# > Advanced > Show live semantic errors

+1
source