Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-288057: [StringFormatMethod] attribute is not working

$
0
0
Reporter Yuri Astrakhan (yurik) Yuri Astrakhan (yurik)
Created Jan 29, 2012 12:08:12 AM
Updated Jan 29, 2012 12:08:12 AM
Priority Normal
Type Bug
Fix versions No Fix versions
State Submitted
Assignee Unassigned
Subsystem No subsystem
Affected versions 6.1
Fixed in build No Fixed in build

namespace JetBrains.Annotations
{
    [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
    public sealed class StringFormatMethodAttribute : Attribute
    {
        public StringFormatMethodAttribute(string formatParameterName)
        {
            FormatParameterName = formatParameterName;
        }

        [UsedImplicitly]
        public string FormatParameterName { get; private set; }
    }
}

namespace MyTest
{
    [Serializable]
    public class TestException : FormattedException
    {
        [StringFormatMethod("message")]
        public TestException(string message, params object[] args)
            : base(string.Format(message, args))
        {
        }
    }

    public class Test
    {
        public static void Main()
        {
            throw new TestException("{0} {1}", 100);   // <--------------- This should be highlighted as a warning
        }
    }
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>