Bug 13360 - File renaming inconsistency in OnFileRenamedInProject
Summary: File renaming inconsistency in OnFileRenamedInProject
Status: NEW
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: master
Assignee: Lluis Sanchez
Depends on:
Reported: 2013-07-20 09:30 UTC by alex
Modified: 2013-07-20 09:51 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

See bug message (174.03 KB, image/png)
2013-07-20 09:31 UTC, alex

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 13360 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description alex 2013-07-20 09:30:32 UTC
There's a bug when renaming files within projects and having overloaded the OnProjectFileRenamed handler:

In the screenshot you see that pf.OldName is 'main.d' which is correct,
pf.NewName is 'mainL.d' which is correct either.

But somehow, Files.GetFile(pf.Oldname) spits out the already renamed project file PLUS Files.GetFile(pf.NewName) doesn't output anything whereas the handler's name contains "FileRenamed" which concludes that the file has actually been renamed already. As soon as I reopen the project, it can't find the physically renamed file
Btw, the renamed file is not opened atm. I also tried it with having the file opened - makes no difference, the bug is still there.

When you look at http://i.imgur.com/pusyzxL.png you will notice the non-updatedness of the dictionary key after I renamed the file -- so the ProjectFile instance becomes updated, the dictionary key not.
Comment 1 alex 2013-07-20 09:31:09 UTC
Created attachment 4385 [details]
See bug message
Comment 2 alex 2013-07-20 09:36:53 UTC
Additional notice: When debugging the execution, Files.files still contains the old file name - and somehow, I can't delete it via any Files.Remove method
Comment 3 alex 2013-07-20 09:51:23 UTC
Okay, it's not that critical anymore: I've solved the problem via Reflection of the 'files' field and manual deletion - Anyway this is still a kinda urgent place to fix!

Thanks in advance!