{"record":{"id":"9ef3a83131dfaeb6","repo":"dotnet/machinelearning","slug":"nameof-channelmessagekind-e-kind-is-not-yet-i","errorCode":null,"errorMessage":"{nameof(ChannelMessageKind)}.{e.Kind} is not yet implemented.","messagePattern":"(.+?)\\.(.+?) is not yet implemented\\.","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.ML.AutoML/Experiment/Experiment.cs","lineNumber":111,"sourceCode":"        {\n            // Relay logs that are generated by the current MLContext to the Experiment class's\n            // _logger.\n            switch (e.Kind)\n            {\n                case ChannelMessageKind.Trace:\n                    _logger.Trace(e.Message);\n                    break;\n                case ChannelMessageKind.Info:\n                    _logger.Info(e.Message);\n                    break;\n                case ChannelMessageKind.Warning:\n                    _logger.Warning(e.Message);\n                    break;\n                case ChannelMessageKind.Error:\n                    _logger.Error(e.Message);\n                    break;\n                default:\n                    throw new NotImplementedException($\"{nameof(ChannelMessageKind)}.{e.Kind} is not yet implemented.\");\n            }\n        }\n\n        public IList<TRunDetail> Execute()\n        {\n            var iterationResults = new List<TRunDetail>();\n            // Create a timer for the max duration of experiment. When given time has\n            // elapsed, MaxExperimentTimeExpiredEvent is called to interrupt training\n            // of current model. Timer is not used if no experiment time is given, or\n            // is not a positive number.\n            if (_experimentSettings.MaxExperimentTimeInSeconds > 0)\n            {\n                _maxExperimentTimeTimer = new Timer(\n                    new TimerCallback(MaxExperimentTimeExpiredEvent), null,\n                    _experimentSettings.MaxExperimentTimeInSeconds * 1000, Timeout.Infinite\n                );\n            }\n            // If given max duration of experiment is 0, only 1 model will be trained.","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.ML.AutoML/Experiment/Experiment.cs#L93-L129","documentation":"RelayCurrentContextLogsToLogger maps channel messages to logger calls by ChannelMessageKind. A new/unhandled kind reaches the default branch, so the library throws NotImplementedException because it has no logging strategy for that message kind.","triggerScenarios":"AutoML experiment's message channel delivers a ChannelMessage whose Kind is neither Progress nor Error (e.g. a newly added ChannelMessageKind enum value from a newer ML.NET channel implementation) while experiment logs are being relayed to ILogger.","commonSituations":"Running AutoML with a custom or upgraded IChannel/ILogger setup where message kinds outside Warning/Error/Progress are emitted; version drift between the channel enum and Experiment's switch.","solutions":["Update Microsoft.ML.AutoML / ML.NET to a version where the switch covers your ChannelMessageKind values.","Catch NotImplementedException around experiment execution and log the raw message instead of crashing.","If custom channel code is in play, only emit kinds the switch handles (Progress, Warning, Error)."],"exampleFix":"// before\ncase ChannelMessageKind.Error:\n    _logger.Error(e.Message);\n    break;\n// after\ncase ChannelMessageKind.Error:\n    _logger.Error(e.Message);\n    break;\ncase ChannelMessageKind.Progress:\n    _logger.Log(LogLevel.Information, e.Message);\n    break;","handlingStrategy":"try-catch","validationCode":"if (!Enum.IsDefined(typeof(ChannelMessageKind), e.Kind) || e.Kind == ChannelMessageKind.Progress)\n    // ensure switch handles all kinds before relaying","typeGuard":"bool IsHandled(ChannelMessageKind k) => k is ChannelMessageKind.Progress or ChannelMessageKind.Error;","tryCatchPattern":"try { experiment.Execute(); }\ncatch (NotImplementedException ex) { _logger.LogWarning($\"Unhandled channel message kind: {ex.Message}\"); }","preventionTips":["Keep ML.NET channel/enum versions aligned with the AutoML package","Cover all enum values in switch statements","Add unit tests relaying each ChannelMessageKind"],"tags":["csharp","logging","not-implemented"],"backgroundTag":"method-not-implemented","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"}