Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pending Changes ignoring some files in VS2019 #17

Open
blazicekj opened this issue Jun 22, 2021 · 13 comments
Open

Pending Changes ignoring some files in VS2019 #17

blazicekj opened this issue Jun 22, 2021 · 13 comments

Comments

@blazicekj
Copy link

  • Same behaviour observed and reported on @PhilJollans fork.
  • Restarting VS sometimes helps, clicking refresh does nothing.
  • I am very much willing to gather logs / anything, but I am not sure how. Would Visual Studio general logfile help?
@rhuijben
Copy link
Member

Which refresh option did you try?
The Visual Studio 'refresh' usually doesn't do much for state that is assumed stable, but the refresh on the pending changes window should refresh the entire cached state.

Saving a file in a visual studio editor should always trigger an update, as would seeing changes on a file that is already opened in Visual Studio (for which VS has a file monitor open). Generated files by buildtools are harder to get right.

What kind of file are we talking about?

@blazicekj
Copy link
Author

I tried the Refresh Pending Changes button in Visual Studio Pending Changes window. I am not completely sure what you mean by Visual Studio 'refresh'.

Saving the file usually does nothing once the Ankh SVN plugin decides to ignore it. Changing the file, saving it and restarting studio usually does refresh Pending changes though and afterwards the Ankh plugin starts tracking changes on that file without problems (e.g. delete the change - file disappears, write something else - it's back). Some of my colleagues report VS restart does not help though.

As for the files - I noticed .qml and .h myself, but .cpp were also reported. It happens on newly checked out and cleaned-up branches as well.

One thing to add - the solution is quite huge, so I'd understand some delays, but this seems just broken when compared to AnkhSVN in VS2015. On 2015 sometimes it missed a file that TortoiseSVN got, but here it's plain ignoring them.

@blazicekj
Copy link
Author

Hello, since this renders SVN in Visual Studio unusable for us I tried debugging the issue, but I am not able to attach to services codes, so I cannot get to the bottom of this fully, but I still managed to get some useful info.

The problem only affects files that are added under filter in c++ projects. E.g. I have a project g5_plugin_storm_new which contains file g5_JobTaskNode_STORMAcq.cpp. If the file is added directly under g5_plugin_storm_new in solution explorer there is no problem, it is registered with Ankh. When it is added under a filter "g5_plugin_storm_new\Tasks" it is ignored. Real path of the cpp does not seem to matter.

When debugging I came across function
private void ItemRefresh(string file)
where the inProject and inExtra bools are false so it is removed from _pendingChanges.

Same goes for void InnerRefresh() where most such files (not all of them though) are not in the list returned by Mapper.GetAllFilesOfAllProjects().

The file is listed in vcxproj as <ClCompile Include="Tasks\g5_JobTaskNode_STORMAcq.cpp" /> and loaded without issues and has an entry in vcxproj.filters.

This problem does not seem to affect header files as heavily (or at all) as cpp.

Any ideas?

Thanks,
Jan.

@blazicekj
Copy link
Author

All filtered files are also not listed under ProjectMap in IProjectFileMapper.ContainsPath

@blazicekj
Copy link
Author

Managed to get the services symbols working. Found out that
if (VSErr.Succeeded(hr = sccProject.GetSccFiles(id, str, dw))) called in Ankh.VS.Selection.SelectionUtils never returns files under filters. I am not completely sure if it should be called with a different ID to return these files or if it is a bug. It returns success and no files.

@blazicekj
Copy link
Author

Opened up a ticket with Microsoft and shared a reproduction procedure / sample solution with them, because I believe the problem may be on their side, rather than AnkhSVN. It seems to be an issue with cache in .vs folder: https://developercommunity.visualstudio.com/t/GetSccFiles-seems-to-ignore-files-in-pro/1487848

Still, you may know how to work around it, so I am leaving the issue open here for the time being.

@rhuijben
Copy link
Member

@blazicekj Thanks for your investigation. You might be right that it is somehow an id issue, but then we probably do something else wrong (by passing some wrong id). Past VS versions have changed rules on when to filter hierarchy items quite a bit and each project implementation slightly bends the rules in different directions and we already have some workarounds.

If you have some tricks that we should apply to .vcxproj, please follow up on this. Other SCC providers (and perhaps Microsoft) may check this repository too when in doubt for something. In the past I could find some issues that say 'this works XXX in AnkhSVN and YYY here, why?'. Being opensource helps both parties there.

@blazicekj
Copy link
Author

@rhuijben Hi, no problem. Just for completeness I will post my conclusions from talking to Microsoft.

The problem seems unrelated to filters after all. I was able to reproduce it with a very simple empty example cpp solution with a single empty cpp file. After uploading said solution to svn you can just run clean-up to remove unversioned or delete the .vs folder manually before opening it in VS to reproduce the problem.

Anyway, I think it's a caching issue. There is some sort of sqlite database with file ids etc. in the .vs folder which is filled as you use the studio. If you open the file after deleting .vs the issue is reproduced and the file is not tracked in pending changes. If you then close and reopen VS, the file is now tracked. This works 100%, even if you don't edit the file on first opening. After closing studio and deleting the .vs folder it is reproducible again.

To me it seems like a problem on Microsoft side, I think GetSccFiles ignores files that were never previously opened in Visual Studio. Which is a huge issue for large solutions where you check out, edit a couple of files to fix a bug and move on to another branch to work on something else. Most files are opened exactly once.

I don't think Microsoft will be fixing this anytime soon even if they do consider it a bug - I'd say VS 2022 if we're lucky, but let's see. It also gives me hope for a possible workaround by fixing up the .vs folder to track all files before creating the Ankh filemap.

@blazicekj
Copy link
Author

@rhuijben Hi, just wanted to share @jeholsa's post on PhilJollans repo as it seems Microsoft is silent on the issue (thanks for weighing in on the report by the way):

He found out that modified files that weren't caught by pending changes automatically have the option to Subversion->Add file to pending changes in context menu when you right click the file tab. Unmodified files don't have this option. I can confirm his findings.

Could this be a way out possibly, or is it using some slow single file only compare?

@rhuijben
Copy link
Member

Add file to pending changes is available on files that are not strictly part of the solution, but which are in related locations and not strictly ignored by the project system.

Projects should report all their files as part of the project, to allow per user files automatically to be ignored. (Part of the SCC spec)

@hgbutte
Copy link

hgbutte commented Nov 16, 2021

I am experiencing this issue with VS2022, but have never had this with VS2019.

@ilChelo
Copy link

ilChelo commented Nov 24, 2021

I am experiencing this issue with VS2022, but have never had this with VS2019.

Me too... I had this problem in VS2017, not in VS2019 and now again in VS2022 but...
...if it can be of any help, once the file is added by hand to "Pending Changes" as belonging to project, from the second restart onwards it is correctly associated.

bye

@hgbutte
Copy link

hgbutte commented Apr 4, 2022

I have come across a problem in VS2022 not finding files when searchîng "Find in Files" which seems somehow connected to this. Files from subfolders seem to show up Pending Changes only when "Show all files" is disabled.

https://developercommunity.visualstudio.com/t/Visual-Studio-2022-v1712---Find-in-Fil/1705121

Maybe someone can try to reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants