{"record":{"id":"35c2fd8ee1580361","repo":"dotnet/machinelearning","slug":"0-and-1-must-be-different","errorCode":null,"errorMessage":"{0} and {1} must be different","messagePattern":"(.+?) and (.+?) must be different","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.Data.Analysis/DataFrame.cs","lineNumber":803,"sourceCode":"\n            if (valueColumns == null && valueColumnList.Count == 0)\n            {\n                throw new InvalidOperationException(Strings.NoValueColumnsRemaining);\n            }\n\n            if (_columnCollection.IndexOf(variableName) >= 0)\n            {\n                throw new ArgumentException(string.Format(Strings.VariableNameAlreadyExists, variableName), nameof(variableName));\n            }\n\n            if (_columnCollection.IndexOf(valueName) >= 0)\n            {\n                throw new ArgumentException(string.Format(Strings.ValueNameAlreadyExists, valueName), nameof(valueName));\n            }\n\n            if (string.Equals(variableName, valueName))\n            {\n                throw new ArgumentException(string.Format(Strings.VariableNameAndValueNameMustBeDifferent, nameof(variableName), nameof(valueName)), nameof(valueName));\n            }\n\n            foreach (var columnName in idColumnList)\n            {\n                if (_columnCollection.IndexOf(columnName) < 0)\n                {\n                    throw new ArgumentException(string.Format(Strings.InvalidColumnName, columnName), nameof(idColumns));\n                }\n            }\n\n            foreach (var columnName in valueColumnList)\n            {\n                if (_columnCollection.IndexOf(columnName) < 0)\n                {\n                    throw new ArgumentException(string.Format(Strings.InvalidColumnName, columnName), nameof(valueColumns));\n                }\n            }\n","sourceCodeStart":785,"sourceCodeEnd":821,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.Data.Analysis/DataFrame.cs#L785-L821","documentation":"Thrown by a public DataFrame reshaping method when variableName and valueName are the same string. The two output columns produced by the melt must have distinct names, so the library rejects identical names up front with Strings.VariableNameAndValueNameMustBeDifferent.","triggerScenarios":"Calling DataFrame.Melt (src/Microsoft.Data.Analysis/DataFrame.cs:803) with variableName == valueName, e.g. both set to \"Key\" or both to a user-supplied single string.","commonSituations":"Binding both output-name parameters to the same config value or user input; copy-paste where one of the two names was not changed; dynamic name generation that returns the same string for both.","solutions":["Pass distinct strings for variableName and valueName","Validate the two names differ before calling the API (string.Equals check)","Catch ArgumentException and prompt the user for a different name"],"exampleFix":"// before\ndf.Melt(new[] {\"Date\"}, new[] {\"A\"}, variableName: \"Column\", valueName: \"Column\");\n// after\ndf.Melt(new[] {\"Date\"}, new[] {\"A\"}, variableName: \"Column\", valueName: \"Value\");","handlingStrategy":"validation","validationCode":"if (string.Equals(variableName, valueName)) throw new ArgumentException(\"variableName and valueName must differ.\");","typeGuard":null,"tryCatchPattern":"try { df.Melt(ids, values, varName, valueName); }\ncatch (ArgumentException ex) when (ex.ParamName == \"valueName\") { /* fix duplicate output names */ }","preventionTips":["Never bind both output-name parameters to the same source value","Centralize melt calls behind a helper that enforces distinct names","Add a unit test covering the rename-melt path with user-supplied names"],"tags":["dotnet","dataframe","argument-exception","duplicate-column"],"backgroundTag":"invalid-argument-value","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"}