Bug 19596 - Refactor / Extract Method removing blank lines
Summary: Refactor / Extract Method removing blank lines
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 4.2.4
Hardware: PC Mac OS
: Normal normal
Target Milestone: (C7)
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2014-05-07 11:43 UTC by John Hair
Modified: 2016-05-18 17:07 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:
VERIFIED FIXED

Description John Hair 2014-05-07 11:43:21 UTC
Using XS 4.2.4 and noticed whilst refactoring that the extract method function now removes all blank lines.

http://forums.xamarin.com/discussion/16444/refactor-extract-method-removing-blank-lines#latest
Comment 1 Ram Chandra 2014-05-07 13:42:14 UTC
I tried this issue but I am unable to reproduce this issue.

Steps to reproduce:
1. Create a console project in XS
2. Paste the following code
    class MainClass
    {
        int Sum(int a, int b)
        {
            int sum = a + b;
            return sum;
        }
        public static void Main(string[] args)
        {
            MainClass objMainClass = new MainClass();
            objMainClass.Sum(10, 20);
        }
    }

3. Select the following line:
        int sum = a + b;
4. Right click on selected line and select "Refactor=> Extract Method" option.
5. Press enter

I observed that when I refactor the code extract method it doesn't remove blank line. It is working fine at our end. 

Could you please provide some steps or screencast to reproduce this issue ?

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

Environment Info:

Mac OS X 10.9.2
Xamarin Studio: 4.2.4 (build 35)

Build Information
Release ID: 402040035
Git revision: 1173cb1c45bc56cb702e82cd21a7c9d0cea4acbf
Build date: 2014-04-17 13:45:52-04
Xamarin addins: 53bde0041263928e8bd64686f5ca5a8e4338dd76

Please let me know if I am missing something.
Comment 2 John Hair 2014-05-07 13:57:46 UTC
Sure, here you go:
http://screencast.com/t/psX4oyCHn

Gotta love Jing!
Comment 3 John Hair 2014-05-07 14:00:21 UTC
I see by your screencast your refactored code doesn't contain any blank lines. That is the issue I am describing, let me know if you see what I mean in my screencast above.

Cheers
John
Comment 4 Ram Chandra 2014-05-07 14:14:37 UTC
I have checked this issue with the help of "Comment2" and "Comment3" and I am able to reproduce this issue.

I observed that when I refactor the code extract method it removes blank lines in present between the code fragment.

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

Environment Info:

Mac OS X 10.9.2
Xamarin Studio: 4.2.4 (build 35)

Build Information
Release ID: 402040035
Git revision: 1173cb1c45bc56cb702e82cd21a7c9d0cea4acbf
Build date: 2014-04-17 13:45:52-04
Xamarin addins: 53bde0041263928e8bd64686f5ca5a8e4338dd76
Comment 5 Michael Teper 2014-09-02 17:00:25 UTC
While you are looking at fixing this, also consider preserving white space and not reformatting the code added to the newly minted method.
Comment 6 Mike Krüger 2014-09-03 00:19:03 UTC
will be fixed in the roslyn version - I suppose it's 1 year away ....
Comment 7 Mike Krüger 2015-05-20 00:40:50 UTC
As promised it's fixed in 6.0 which will be released in about ~ 2 months.
Comment 8 Abhishek 2016-05-18 17:07:20 UTC
I have checked this issue with latest C7 build:
XamarinStudio-6.0.0.5156_6bb41168165682b4ed22a94364bf0cf24e6b1d5c. Now this issue is working fine. Here is the screencast for the same: http://www.screencast.com/t/q83QIgvt

Hence closing this issue.

Thanks!