Share via


Code error underline problem in C#

Question

Saturday, December 26, 2009 10:08 AM

The code error underline feature of Visual Sutdio does not works well in C#.
For example if I type following:

functionNotExist();

It won't be underlined until I start debugging or complie.

In VB.NET this problem never happened.

Please help!
Amit

All replies (10)

Monday, December 28, 2009 10:30 AM âś…Answered

Hi Amit,

Thank you for your good video. I can understand the scenario that you had better.

For wavy underline feature in Visual Studio IDE, a red wavy underline identifies a syntax error, such as a missing semicolon or mismatched braces, or a semantic error. A green wavy underline identifies a potential compiler warning, and blue identifies compiler errors.

Also if I correct that function name it won't remove the underline until again I build it.

Since blue wavy underline identifies compiler errors, the underline will disappear when we correct the source code and build our project again. This behavior is normal. I have the same on my machine.

Hi Yichun,
It does underline but the problem is that it won't underline for error and vice-versa until I build it.
For example if I enter
**someFunctionNotExist();
**it won't underline but when build.

This scenario is not behaved as normal. Generally, if we write some code with syntax error, red wavy underline will appear.
However, I notice that there is no red wavy underline in your video.

Could you please try the points mentioned here: http://social.msdn.microsoft.com/Forums/en-US/vssetup/thread/0376db8f-4761-4ae5-9af2-98c53216318a#VS_IDE_unexpected_problems to eliminate the possible cause of your issue?

Have you ever installed any third-party tools? If yes, running "devenv.exe /SafeMode" can hopefully solve your issue since this can eliminate the possibility that third party Add-ins or packages are causing problems.

Hope this helps!

Best regards,
Yichun ChenPlease remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


Monday, December 28, 2009 4:41 AM

Hi Amit,

Thank you for your post.

To display underline feature via Visual Studio IDE, could you please help me to check whether the feature has been checked?
Please go to Tools menu >> Options >> Expand "Text Editor" >> C# >> Advanced >> "Underline errors in the editor".

If it doesn't work, you might try running devenv.exe /ResetSettings switch in Command Prompt, which restores the default Visual Studio settings.

Hope this helps! If you have any concern, please feel free to let me know.

Best regards,
Yichun ChenPlease remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


Monday, December 28, 2009 8:09 AM

Hi Yichun,
It does underline but the problem is that it won't underline for error and vice-versa until I build it.
For example if I enter
**someFunctionNotExist();
**it won't underline but when build.

Also if I correct that function name it won't remove the underline until again I build it.

This problem does not exist in VB.NET I think.

Amit


Monday, December 28, 2009 8:27 AM | 1 vote

Hi Amit,

Thank you for your clarification.

For VS IDE issue, there would be some causes for the issue to happen. Thus, we need to narrow down the possible cause.

I followed the steps you mentioned but could not reproduce the scenario that you came across. I could notice red underline under the code "someFunctionNotExist();" even I did not build my C# Winform application.

Based on your description, it sounds like your issue could be related to corrupted VS settings. That's the reason why I would suggest you to try running devenv.exe /ResetSettings in Command Prompt to restore the default Visual Studio settings. This would help us to isolate the possible cause of IDE Settings. Have you tried that?

If this doesn't work, you can try the option -- devenv.exe /resetuserdata.  This will reset VS to its out-of-box state.
For more information, please check: http://msdn.microsoft.com/en-us/library/bb245788(VS.80).aspx#vs05idetips_topic6 .
Be aware that this will reset all of your VS environment and customization settings.

Hope this helps! If you have any concern, please feel free to let me know.

Best regards,
Yichun Chen

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


Monday, December 28, 2009 9:19 AM

Hi Yichun!
Thanks for your quick reply.
I have just tried both of the commands you mentioned but it not worked. I have tried before reset the setting of VS but it did not work.

I have uploaded the problem video, please take a look at it. This video has been created after applying/trying you two commands mentioned earlier.

http://cid-b5bbb28998fe25b5.skydrive.live.com/self.aspx/TechQuestionVideos/2009-11/VS-CodeErrorUnderlineProblemC%5E3.avi
Amit


Monday, December 28, 2009 10:59 AM

Yichun,
Thanks for your descriptive answer. I appreciate that.

I noticed the problem becuase my background is VB and with VB.NET if you have some comilier error (blue wavy line), it shown instantly.
For example if I type in vb.net
**functionNotExist()
**it will put wavy underline instantly and the tooltip will show "Name functionNotExist() not declared".

Why VB.NET and C# IDE has difference behaviour?

Amit


Tuesday, December 29, 2009 3:46 AM | 1 vote

Hi Amit,

It's my pleasure!

It's by design. Visual C++ IDE is also different from Visual Basic IDE and Visual C# IDE.

If you have any good suggestion on VB IDE and C# IDE, you could post your feedback on the following URL:
https://connect.microsoft.com/VisualStudio.
Every feedback submitted will be evaluated carefully by our engineers.

Hope this helps!

Have a great week.

Best regards,
Yichun ChenPlease remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


Saturday, January 30, 2010 3:11 PM

I had the same problem. Errors was not underlined in visual studio. The command  devenv.exe/resetuserdata worked for me. I think the problem came when I uninstalled Resharper or a ctrl+k, ctrl+something command. But now it works smoothly :-)


Thursday, October 14, 2010 2:49 PM

I have the same problem in C# (VS2008 Professional). Resetting the user data or starting in safe mode did not help. I have no add-ins installed.

Any idea what else I can try?


Monday, May 30, 2011 3:13 PM

This one worked for me!  Thank you sir :)