Search code examples
monodevelop

In MonoDevelop, what causes the “red-x” error-icon when my solution builds and runs without errors?


I've created a small Hello World ASP.NET project in MonoDevelop. Those red-x (red diagonal crosses) appeared on most of the file icons in my solution, at the bottom right.

The project still compiles and runs, and there are no obvious problems or indication what causes them. I tried hovering the cursor over the icons but no tooltip appears.

Do these icons indicate a real problem with my project, or do they just appear at random?

Here's a screenshot of the problem solution (left), and a fresh solution for comparison (right):

enter image description hereenter image description here


Solution

  • The red error overlay icon is from version control.

    If you are using Git then red icon means the file has been deleted and recreated when compared with the last commit.

    One way to reproduce this is to create a new C# console project with a local git repository. Commit the new project to Git locally, no need to push it to a remote repository. Then with MonoDevelop delete Program.cs and then create a new Program.cs file again in the same location. Then you should see a red icon which means the file is marked as removed in Git.

    If you then open up a command line and run git status you should see something like:

    On branch master
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
        deleted:    MyProject/Program.cs
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)
    
        modified:   MyProject/MyProject.csproj
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
        MyProject/Program.cs