[256] Attribute usage

I've noticed in build 265 (and perhaps in previous builds), when I apply an attribute to a method ReSharper adds a using alias instead of employing the existing using statements. As an example, I have a class that has the following basic code:
 
using System.Net;
 
public class X
{
    public void Connect(EndPoint endPoint)
    {
    }
}
 
If I add SocketsPermissionAttribute to the Connect method, ReSharper turns it into an alias:
 
using System.Net;
using Net_SocketPermission=System.Net.SocketPermission;
 
public class X
{
    [Net_SocketPermission(EndPoint endPoint)]
    public void Connect()
    {
    }
}
 
I should also mention that I have "Allow alias using directive" turned off.
 
]]>

2 comments
Comment actions Permalink

I cannot reproduce your problem.
Please could you send me a small sample solution which shows this problem

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
I've noticed in build 265 (and perhaps in previous builds), when I apply an attribute to a method ReSharper adds a using alias instead of employing the existing using statements. As an example, I have a class that has the following basic code:
 
using System.Net;
 
public class X
{
    public void Connect(EndPoint endPoint)
    {
    }
}
 
If I add SocketsPermissionAttribute to the Connect method, ReSharper turns it into an alias:
 
using System.Net;
using Net_SocketPermission=System.Net.SocketPermission;
 
public class X
{
    [Net_SocketPermission(EndPoint endPoint)]
    public void Connect()
    {
    }
}
 
I should also mention that I have "Allow alias using directive" turned off.
 
]]>

0
Comment actions Permalink

This is the smallest class I can create to reproduce the problem. At the moment all of the using declarations in place, so position the cursor at the blank line above the Connect method. Press Enter and then type [SocketPermission(. When you type the open parenthesis, ReSharper changes it to Net_SocketPermission and inserts using Net_SocketPermission=System.Net.SocketPermission. If I type [SocketPermissionAttribute(, it changes it to SocketPermission and works correctly. However, the SocketPermission class should not be an available option in an attribute section.
 
using System.Net;
using System.Net.Sockets;
 
namespace TestProject1
{
    public class Test
    {
        private TcpClient client;
 
        public void Connect()
        {
            client = new TcpClient("server", 110);
        }
    }
}

--

"Eugene Pasynkov (JetBrains)" <Eugene.Pasynkov@jetbrains.com> wrote in message news:eakr00$7lm$1@is.intellij.net...
I cannot reproduce your problem.
Please could you send me a small sample solution which shows this problem

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
I've noticed in build 265 (and perhaps in previous builds), when I apply an attribute to a method ReSharper adds a using alias instead of employing the existing using statements. As an example, I have a class that has the following basic code:
 
using System.Net;
 
public class X
{
    public void Connect(EndPoint endPoint)
    {
    }
}
 
If I add SocketsPermissionAttribute to the Connect method, ReSharper turns it into an alias:
 
using System.Net;
using Net_SocketPermission=System.Net.SocketPermission;
 
public class X
{
]]>    
    public void Connect()
    {
    }
}
 
I should also mention that I have "Allow alias using directive" turned off.
 
]]>

0

Please sign in to leave a comment.