{"record":{"id":"240f1c6127a0bb35","repo":"dotnet/machinelearning","slug":"parameter-must-not-be-null-empty-or-whitespace","errorCode":null,"errorMessage":"Parameter must not be null, empty, or whitespace","messagePattern":"Parameter must not be null, empty, or whitespace","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.Data.Analysis/DataFrame.cs","lineNumber":743,"sourceCode":"        /// // |----|-------|------|-------|\n        /// // | 1  | Alice | 2020 | 100   |\n        /// // | 2  | Bob   | 2020 | 200   |\n        /// // | 1  | Alice | 2021 | 110   |\n        /// // | 2  | Bob   | 2021 | 210   |\n        /// // | 1  | Alice | 2022 | 120   |\n        /// // | 2  | Bob   | 2022 | 220   |\n        /// </code>\n        /// </example>\n        /// <remarks>\n        /// Note: The output rows are ordered by value column (all rows for the first value column,\n        /// then all rows for the second, etc.), which differs from pandas.melt() which orders by\n        /// source row.\n        /// </remarks>\n        public DataFrame Melt(IEnumerable<string> idColumns, IEnumerable<string> valueColumns = null, string variableName = \"variable\", string valueName = \"value\", bool dropNulls = false)\n        {\n            if (string.IsNullOrWhiteSpace(variableName))\n            {\n                throw new ArgumentException(Strings.ParameterMustNotBeNullOrWhitespace, nameof(variableName));\n            }\n\n            if (string.IsNullOrWhiteSpace(valueName))\n            {\n                throw new ArgumentException(Strings.ParameterMustNotBeNullOrWhitespace, nameof(valueName));\n            }\n\n            if (idColumns == null)\n            {\n                throw new ArgumentNullException(nameof(idColumns));\n            }\n\n            var idColumnList = idColumns.ToList();\n\n            HashSet<string> idColumnSet = null;\n\n            if (valueColumns is null)\n            {","sourceCodeStart":725,"sourceCodeEnd":761,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.Data.Analysis/DataFrame.cs#L725-L761","documentation":"Thrown by DataFrame.Melt when the variableName argument is null, empty, or whitespace. Melt reshapes wide data into long format and needs a valid name for the new 'variable' column it creates. The guard raises ArgumentException with Strings.ParameterMustNotBeNullOrWhitespace.","triggerScenarios":"Calling df.Melt(idColumns, valueColumns, variableName: \"\", ...) or with variableName: null or a whitespace string such as \" \".","commonSituations":"Programmatically building melt arguments from config where an optional setting resolves to empty string; users forgetting that variableName has a default but explicitly passing empty to override it.","solutions":["Pass a non-empty non-whitespace variableName, e.g. \"variable\"","Omit the argument entirely to use the default value \"variable\"","Trim/default the value at the call site if it comes from user input or config"],"exampleFix":"// before\ndf.Melt(ids, values, variableName: \"\");\n// after\ndf.Melt(ids, values, variableName: \"variable\");","handlingStrategy":"validation","validationCode":"if (string.IsNullOrWhiteSpace(variableName)) variableName = \"variable\";","typeGuard":null,"tryCatchPattern":"try { df.Melt(ids, values, variableName); }\ncatch (ArgumentException ex) when (ex.ParamName == \"variableName\") { /* supply default and retry */ }","preventionTips":["Rely on default parameter values instead of passing empty strings","Sanitize config-driven names with string.IsNullOrWhiteSpace checks","Validate names at config load time"],"tags":["dotnet","dataframe","melt","argument-validation"],"backgroundTag":"empty-required-field","analyzedSha":"7b76e69cf964daeca3f1377af6bc5543284d56c6","analyzedAt":"2026-09-11T12:35:38.930Z","contentChangedAt":"2026-09-11T12:35:38.930Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}