Clean vs Fix Usings

2 posts, 0 answers
  1. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 01 Feb 2012 Link to this post

    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
  2. Svetlozar
    Admin
    Svetlozar avatar
    269 posts

    Posted 06 Feb 2012 Link to this post

    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 >>
  3. DevCraft banner
Back to Top