This is a migrated thread and some comments may be shown as answers.

Clean vs Fix Usings

1 Answer 43 Views
Refactorings
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 01 Feb 2012, 05:48 PM
When I Fix Usings JC moves all of my aliases to the bottom of the Usings block...
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using CommSec = UEAPL.Common.PresentationLayer.WorkgroupSecurityServiceProxy;
using Utils = UEAPL.Shared.Utilities;

and then, when I clean my code, JC sorts the aliases in to the Usings block alphabetically...
using CommSec = UEAPL.Common.PresentationLayer.WorkgroupSecurityServiceProxy;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using Utils = UEAPL.Shared.Utilities;

I know I've mentioned this before and I know that you said that the 2 functions do things differently. The point is I can't even begin to imagine what a good reason for that behaviour might be.

The current behaviour means that we get changes in out source code change history that are not really part of the actual changes if programmer A cleans the code last and programmer B fixes the usings last.

Please, sort it out.

FWIW, I think Fix Usings does it (putting the aliases at the bottom) is the way to go.

--
Stuart

1 Answer, 1 is accepted

Sort by
0
Svetlozar
Telerik team
answered on 06 Feb 2012, 07:03 PM
Hi,

This is clearly a bug. Could you please help us reproduce it. I tried with

using CommSec = UEAPL.Common.PresentationLayer.WorkgroupSecurityServiceProxy;
using System;
using System.Linq;
using Utils = UEAPL.Shared.Utilities;

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            CommSec a = new CommSec();
            Utils b = new Utils();
        }
    }
}

namespace UEAPL.Common.PresentationLayer
{
    public class WorkgroupSecurityServiceProxy { }
}

namespace UEAPL.Shared
{
    public class Utilities { }
}

Cleaning with all steps excluding Arrange namespaces sorted the using directives in  the right way for me.
Could you please send a sample solution.
 
All the best,
Svetlozar
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Refactorings
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Svetlozar
Telerik team
Share this question
or