Bug 23397 - Refactoring - When renaming file. Does not rename class.
Summary: Refactoring - When renaming file. Does not rename class.
Status: RESOLVED FEATURE
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: 5.5
Hardware: PC Mac OS
: Normal normal
Target Milestone: master
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-26 04:34 UTC by leslie.godwin
Modified: 2014-09-26 11:03 UTC (History)
4 users (show)

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

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 on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description leslie.godwin 2014-09-26 04:34:31 UTC
Description of Problem:

Steps to reproduce the problem:
1. Rename a file.

Actual Results:

Class contained in the class.cs file should also be refactored.

Expected Results:

Only the filename is changed.

How often does this happen? 

All the time.

Additional Information:

Or at least have a checkbox (like in the rename class function) to suggest renaming the class as well.
Comment 1 Sadik Ali 2014-09-26 05:06:02 UTC
I have checked this issue and I am able to reproduce this issues.

Steps I followed:

1. Create a console project in XS.
2. Add a new empty class to the project.
3. In solution view right click on file name and select "Rename" option
4. Enter the name to the class

I observed that when I rename the .cs file from the solution view the class is not changed.

Screencast: http://www.screencast.com/t/ZBH86H4S

Note: When I click on any class name in editor and choose the  "Refactor => Rename" option and enter the new class name in "New Name" text box with "rename file that contains public class" check box is checked and press ok button it rename the class name and also rename the file name.

Environment Info:

Mac OS X 10.9.5
Xamarin Studio 5.5 (build 221)
Runtime:
	Mono 3.10.0 ((detached/ac51002)
	GTK+ 2.24.23 (Raleigh theme)
	Package version: 310000016

=== Build Information ===

Release ID: 505000221
Git revision: 5593ae2759cc72daba96ad1a7bcf2b584a26e1cc
Build date: 2014-09-25 17:56:39-04
Xamarin addins: 9c609d1ca384863aafef4336d94b4b55d059d4ff
Comment 2 PJ 2014-09-26 11:03:10 UTC
Hi Leslie, I'm not sure the expected behavior in the description would be the expected behavior for all users. 

When a user is renaming a class and the name of the file is the class name, it makes sense to me that the file should be renamed. Most people who have single-class files will want the name of the file to be the class name.

When a user explicitly renames a file without refactoring the class, there are any number of reasons why they might want to just rename the file and not the class.

I'm going to resolve this as a FEATURE, but I'm open to other arguments for why this should be the universal expected behavior, I may be missing something. If so please REOPEN.