Roman Hoog Antink
Roman Hoog Antink

Reputation: 41

TeamExplorer with git in VisualStudio 2017 claims solution file has changed, while showing no change

At some point in the project, TeamExplorer began to constantly indicate changes on the solution file, but the comparison with the unmodified version in VS does not show any change.

Screenshot: Team Explorer claiming solution file has been changed

What I tried so far:

  1. To exclude a git issue, I opened git bash and ran git status, but no changes show up either.
  2. The Team Explorer's git console shows this, when I try to stage the ghost update:

    File not staged because it is modified in memory but not saved to disk: C:\Develop\playground\ClassLibrary1\ClassLibrary1.sln

  3. Clicking any save buttons or menu function in VS won't help.

  4. Trying to commit this ghost change by the Commit All action button, VS displays a general error "fatal: unexpected sequence in commit output.".

  5. Re-cloning the entire repo doesn't help.

  6. Committing other changes onto the solution file won't help.

  7. Line endings checkout fine (CR/LF).

Visual Studio Version is 15.5.5.

Any idea whats causing this or how to get rid of it?


This is my solution file:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2026
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1\ClassLibrary1.csproj", "{3E6F764F-D995-4551-921E-43D70B3129B8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E9781EEA-6178-46BD-82B9-AED6B76C8D14}"
    ProjectSection(SolutionItems) = preProject
        version.json = version.json
    EndProjectSection
    ProjectSection(FolderGlobals) = preProject
         __JSONSchema = 
    EndProjectSection
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {3E6F764F-D995-4551-921E-43D70B3129B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {3E6F764F-D995-4551-921E-43D70B3129B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {3E6F764F-D995-4551-921E-43D70B3129B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {3E6F764F-D995-4551-921E-43D70B3129B8}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {7EDCF511-FC54-4E98-9064-11E9A1B43DD1}
    EndGlobalSection
EndGlobal

Upvotes: 1

Views: 942

Answers (2)

Roman Hoog Antink
Roman Hoog Antink

Reputation: 41

I could solve the issue by removing the line

__JSONSchema = 

This line has been introduced while the JSON file version.json was added to the solution. The schema drop down box in the JSON file editor was set to an arbitrary entry by VisualStudio. Then I chose <No schema selected> and saved the solution. That's how the broken line was created.

Upvotes: 1

Chad B
Chad B

Reputation: 1506

The * beside the filename in the Changes page indicates that the file is marked as modified in memory and any in-memory changes may not have been written out to disk. There are unfortunately a few scenarios where the * may be present even if there is no actual change to the file.

The reason is the source control provider is notified whenever a file loaded in Visual Studio is about to be modified. A source control provider that supports pre-edit checkout (ex: TFVC) may choose to automatically pend an edit on the file prior to the change (if working in a server workspace). A source control provider that doesn't use pre-edit checkout (ex: Git) may still choose to proactively list the file as an edit so the user knows there are in-memory changes.

In either case, the subsystem in Visual Studio that notified the source control provider may not actually follow through and edit the file. This can lead to a file shown as edited in memory but with no actual change. Saving the file (for solution, File->Save All) should cause the file's state to be reset, at least until the next edit notification comes in.

Hope this helps.

Upvotes: 1

Related Questions