[262] R# breaks code on format

Hi,

I have some cases where 'reformat code' with all checkboxes ticked,
causes R# to break code.

It is caused when a static method is called on a class, where the class
has the same name as a property.

in this case:

public class MyPage : System.Web.UI.Page
{

void Method(string message)
{
System.Diagnostics.Trace.WriteLine(message);
}

}

is reformatted to this:

using System.Diagnostics;
using System.Web.UI;

public class MyPage : System.Web.UI.Page
{

private void Method(string message)
{
Trace.WriteLine(message);
}

}

but since "Trace" is also an inherited property from "Page" this line
doesn't compile:
Trace.WriteLine(message);

Best Regards,

Wiebe Tijsma

2 comments
Comment actions Permalink

I cannot reproduce this issue.
At my side, after re-formatting the file is:

using System.Web.UI;

public class MyPage : Page

{

private void Method(string message)

{

System.Diagnostics.Trace.WriteLine(message);

}

}


--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Wiebe Tijsma" <wiebeREMOVE@CAPITALStijsma.com> wrote in message
news:eetm84$7eh$1@is.intellij.net...

Hi,

>

I have some cases where 'reformat code' with all checkboxes ticked, causes
R# to break code.

>

It is caused when a static method is called on a class, where the class
has the same name as a property.

>

in this case:

>

public class MyPage : System.Web.UI.Page
{

>

void Method(string message)
{
System.Diagnostics.Trace.WriteLine(message);
}

>

}

>

is reformatted to this:

>

using System.Diagnostics;
using System.Web.UI;

>

public class MyPage : System.Web.UI.Page
{

>

private void Method(string message)
{
Trace.WriteLine(message);
}

>

}

>

but since "Trace" is also an inherited property from "Page" this line
doesn't compile:
Trace.WriteLine(message);

>

Best Regards,

>

Wiebe Tijsma



0
Comment actions Permalink

Eugene Pasynkov (JetBrains) wrote:

I cannot reproduce this issue.
At my side, after re-formatting the file is:

using System.Web.UI;

public class MyPage : Page

{

private void Method(string message)

{

System.Diagnostics.Trace.WriteLine(message);

}

}


Sorry, I assumed this would be the case, I'll see if I can reproduce it
in a smaller solution...

0

Please sign in to leave a comment.