{"record":{"id":"fdd983dbaae2a8fc","repo":"dotnet/BenchmarkDotNet","slug":"property-name-must-be-non-empty","errorCode":null,"errorMessage":"Property name must be non-empty.","messagePattern":"Property name must be non-empty\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet/Jobs/Argument.cs","lineNumber":123,"sourceCode":"    }\n\n    /// <summary>\n    /// An MSBuild property argument (<c>/p:name=value</c>).\n    /// It escapes MSBuild special characters in the value (for example, semicolons) so that\n    /// list-like values can be passed without manual encoding.\n    /// </summary>\n    [PublicAPI]\n    public class MsBuildProperty : MsBuildArgument\n    {\n        public MsBuildProperty(string name, params string[] values)\n            : base(CreateArgumentTextRepresentation(name, values), escapeSpecialCharacters: true)\n        {\n        }\n\n        private static string CreateArgumentTextRepresentation(string name, string[] values)\n        {\n            if (string.IsNullOrWhiteSpace(name))\n                throw new ArgumentException(\"Property name must be non-empty.\", nameof(name));\n\n            if (values is null)\n                throw new ArgumentNullException(nameof(values));\n\n            for (int i = 0; i < values.Length; i++)\n                if (values[i] is null)\n                    throw new ArgumentException(\"Property values can not contain null.\", nameof(values));\n\n            string value = values.Length switch\n            {\n                0 => string.Empty,\n                1 => values[0],\n                _ => string.Join(\";\", values)\n            };\n\n            return $\"/p:{name}={value}\";\n        }\n    }","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet/Jobs/Argument.cs#L105-L141","documentation":"MsBuildProperty's constructor requires a non-empty property name; CreateArgumentTextRepresentation throws ArgumentException (\"Property name must be non-empty.\") when name is null, empty, or whitespace. The name becomes part of the /p:NAME=value MSBuild argument and must be a real identifier.","triggerScenarios":"Calling new MsBuildProperty(\"\", ...) or new MsBuildProperty(\"   \", ...) (or null name) when adding an MSBuild property to a benchmark job.","commonSituations":"Building property names dynamically from config/variables that may be unset, whitespace from trimmed input, or copy-paste leaving an empty name.","solutions":["Provide a concrete non-empty property name, e.g. new MsBuildProperty(\"MyCustomSetting\", \"123\").","Validate with !string.IsNullOrWhiteSpace(name) before constructing the MsBuildProperty.","If the name is optional, skip adding the property entirely rather than passing empty."],"exampleFix":"// before\njob.WithArgument(new MsBuildProperty(\"\", \"123\"));\n\n// after\njob.WithArgument(new MsBuildProperty(\"MyCustomSetting\", \"123\"));","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException(\"name required\");\njob.WithArgument(new MsBuildProperty(name, value));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply a concrete property name to MsBuildProperty.","Validate names when building them dynamically.","Skip adding the property when the name would be empty."],"tags":["msbuild","validation","argument","config"],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}