Microsoft.CodeAnalysis.Sarif.MessageUtilities.BuildMessage C# (CSharp) Method

BuildMessage() public static method

public static BuildMessage ( IAnalysisContext context, string messageFormat ) : string
context IAnalysisContext
messageFormat string
return string
        public static string BuildMessage(IAnalysisContext context, string messageFormat, params string[] arguments)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (arguments == null)
            {
                throw new ArgumentNullException(nameof(arguments));
            }

            // By convention, the first argument is always the target name,
            // which we retrieve from the context
            Debug.Assert(File.Exists(context.TargetUri.LocalPath));
            string targetName = context.TargetUri.GetFileName();

            string[] fullArguments = new string[arguments != null ? arguments.Length + 1 : 1];
            fullArguments[0] = targetName;

            if (fullArguments.Length > 1)
            {
                arguments.CopyTo(fullArguments, 1);
            }

            return String.Format(CultureInfo.InvariantCulture,
                messageFormat, fullArguments);
        }