Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does purple underlines mean in visual studio editor?

I am facing some purple (or violet?) underlines in Visual Studio 2015 today, something I have never seen before.

purple underlines in Visual Studio Editor

I held the cursor over the text but nothing happened(It happens sometimes). I googled it and got nothing.

What does it mean? How do difference types of underlines represent different kinds of warnings in VS?

Here is some hint: I later found myself editing the source while the program is still running. When I stop the program, the underline disappeared. So I presume it has something to do with the current state of debugging.

like image 609
王凯越 Kaiyue Wang Avatar asked Jan 21 '17 02:01

王凯越 Kaiyue Wang


People also ask

What do the colors in Visual Studio mean?

Here's your quick reference to the colors and icons in the editor window's right-hand margin: Yellow: The line has been changed but not yet saved. Green: The line has been changed and saved. Orange: The line has been changed, saved, and the change undone. Little square dots in the middle of the margin: Break points.

Can I use Visual Studio as a code editor?

Visual Studio CodeA standalone source code editor that runs on Windows, macOS, and Linux. The top pick for JavaScript and web developers, with tons of extensions to support just about any programming language.

What is code editor in Visual Basic?

The Visual Studio editor provides many features that make it easier for you to write and manage your code and text. You can expand and collapse different blocks of code by using outlining. You can learn more about the code by using IntelliSense, the Object Browser, and the Call Hierarchy.


1 Answers

In this case, you see the purple edit because you're modifying code while it's running. see https://msdn.microsoft.com/en-us/library/ba77s56w.aspx:

When you make an unauthorized edit, the change is marked with a purple wavy underline and a task is displayed in the Task List. You must undo an unauthorized edit if you want to continue to use Edit and Continue. Certain unauthorized edits may be permitted if done outside Edit and Continue. If you want to retain the results of such an unauthorized edit, you must stop debugging and restart your application.

A purple underline could also show up when there's an error in code that won't be run because of some circumstance, like an #IFDEF. see https://msdn.microsoft.com/en-us/library/dn957937.aspx:

A purple squiggle appears in a shared project when there is an error in code that is not currently active, for example when you are working in the Windows context but enter something that would be an error in an Android context. A red squiggle indicates a compiler error or warning in active code that you need to deal with.

like image 69
fafrd Avatar answered Sep 20 '22 15:09

fafrd