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

RSRP-288057: [StringFormatMethod] attribute is not working in constructors

$
0
0
Reporter Yuri Astrakhan (yurik) Yuri Astrakhan (yurik)
Created Jan 29, 2012 12:08:12 AM
Updated Apr 16, 2018 11:58:21 AM
Resolved Apr 16, 2018 11:58:21 AM
Subsystem Matching Elements - String Format
Assignee Alisa Afonina (alisa.afonina)
Priority Major
State Obsolete
Type Bug
Fix version Backlog
Affected versions 6.1
Fixed In Version ReSharper Undefined
VsVersion All Versions

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 : Exception
{
[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>