An open source tool for arranging .NET source code

Forums > Help > Using statement inside Namespace


9/14/2009 8:49:16 AM
Gravatar
Total Posts 8

Using statement inside Namespace

When I run the Narrange on my project, it puts using statement inside the namespace.

namespace MySoft.WebUI
{
  using System;
}

While what I like is to keep the using statement at the TOP of the file as shown below.

namespace MySoft.WebUI
{
  using System;
}

I have tries to run the NArrange CONFIG with namespace setting but did not work and my using statements are inside the namespace...

Please advice.

Thanks in advance.




9/14/2009 10:21:33 AM
Gravatar
Total Posts 30
James Nies
- NArrange Developer
Astral Softworks

Re: Using statement inside Namespace

Hi there,

Are you also passing the path to your custom configuration file to the command line via the /c command argument?  NOTE: The default config file is only provided as an example and NArrrange will not look at modifications to it unless instructed to do so.  It is recommended to make a copy of the default config, edit it and supply the config override.

If that doesn't seem to be the issue, could you post the namespace setting XML that you are using?

Thanks,

James Nies
NArrange Developer




9/14/2009 7:16:44 PM
Gravatar
Total Posts 8

Re: Using statement inside Namespace

Hi James,

Thanks  for your reply.

I was using the config tool, but do not passing the name of config file in a command line parameter.

I will retry with passing name of config file in a command line and let you know.

Thanks.

---------------

Hi Jmaes,

I have tried and it failed with an error due to two class (small classes) are in a single class file.

I get below error.

Parsed Helpers\ViewStateHelper.cs
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at NArrange.Core.CodeArranger.MoveUsings(List`1 elements, NamespaceElement namespaceElement)
at NArrange.Core.CodeArranger.Arrange(ReadOnlyCollection`1 originalElements)
at NArrange.Core.FileArranger.ArrangeElements(ReadOnlyCollection`1 elements)
at NArrange.Core.FileArranger.ArrangeSourceFile(String inputFile, String outputFile)
at NArrange.Core.FileArranger.Arrange(String inputFile, String outputFile, Boolean backup)
at NArrange.ConsoleApplication.Program.Run(ILogger logger, CommandArguments commandArgs)
at NArrange.ConsoleApplication.Program.Main(String[] args)

Thanks.

 




9/15/2009 12:12:23 AM
Gravatar
Total Posts 30
James Nies
- NArrange Developer
Astral Softworks

Re: Using statement inside Namespace

Ok, I'll try to replicate the issue you're seeing. Are the two classes defined within a namespace or not and are using statements present?  Also, were you arranging a file that had using statements within the namepace or outside?

Or, if you have a simple sample that demonstrates the issue, could you post it here or to the bug tracker at SourceForge?  Based on the exception being generated, this definitely looks like a bug.

Thanks




9/15/2009 12:43:57 AM
Gravatar
Total Posts 8

Re: Using statement inside Namespace

Hi James,

Are the two classes defined within a namespace : YES

using statements present: AT THE TOP OF THE FILE ALL USING STATEMENTS

were you arranging a file that had using statements within the namepace or outside?: OUTSIDE (FOR BOTH CLASSES ALL USING STATEMENT TOGETHER AT TOP OF THE FILE).

Let me know if you need any more information.

Thanks.




9/16/2009 11:17:58 PM
Gravatar
Total Posts 8

Re: Using statement inside Namespace

 Hi James,

Any more info you require?

I'm waiting for this bug to fix to that we can use this nice tool in our large scale project.

Thanks.




9/27/2009 7:09:13 PM
Gravatar
Total Posts 8

Re: Using statement inside Namespace

Hi James,

At what email address I can send you the  C# file (as an attachment) that is causing it to break?

Cheers.

 




10/11/2009 11:44:24 PM
Gravatar
Total Posts 30
James Nies
- NArrange Developer
Astral Softworks

Re: Using statement inside Namespace

Kakaiya,

I've filed Bug 2876861 for this issue but unfortunately have not been able to replicate the issue using 2 simple classes in a single file.  Could you please visit the bug link and upload a sample C# file and your custom NArrange config as attachments for the bug? 

Thanks!




10/12/2009 1:05:40 AM
Gravatar
Total Posts 8

Re: Using statement inside Namespace

That's uploaded there.

Thanks James

Kakaiya




10/13/2009 2:12:24 PM
Gravatar
Total Posts 30
James Nies
- NArrange Developer
Astral Softworks

Re: Using statement inside Namespace

Kakaiya,

A fix for this has been checked in.  If you have an SVN client, you can check out and build the latest source code from the repository located at:
https://narrange.svn.sourceforge.net/svnroot/narrange

Please let me know if you encounter any issues.

James





Site Map | Printable View | © 2008 - 2010 NArrange | Powered by mojoPortal | XHTML 1.0 | CSS | Site provided by Astral Softworks, LLC