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
}
}
}