{"record":{"id":"ae5e408952de3669","repo":"stride3d/stride","slug":"unsupported-log-message","errorCode":null,"errorMessage":"Unsupported log message.","messagePattern":"Unsupported log message\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"sources/core/Stride.Core/Diagnostics/LogListener.cs","lineNumber":144,"sourceCode":"        return TextFormatter(logMessage);\n    }\n\n    /// <summary>\n    /// Gets the text that describes the exception associated to a particular log message.\n    /// </summary>\n    /// <param name=\"message\">The log message.</param>\n    /// <returns>A textual representation of the exception, or <see cref=\"string.Empty\"/> if no exception is associated to this log message.</returns>\n    protected virtual string GetExceptionText(ILogMessage message)\n    {\n        if (message is SerializableLogMessage serializableLogMessage)\n        {\n            return serializableLogMessage.ExceptionInfo?.ToString() ?? string.Empty;\n        }\n        if (message is LogMessage logMessage)\n        {\n            return logMessage.Exception?.ToString() ?? string.Empty;\n        }\n        throw new ArgumentException(\"Unsupported log message.\");\n    }\n\n    /// <summary>\n    /// Performs an implicit conversion from <see cref=\"LogListener\"/> to <see cref=\"Action{ILogMessage}\"/>.\n    /// </summary>\n    /// <param name=\"logListener\">The log listener.</param>\n    /// <returns>The result of the conversion.</returns>\n    public static implicit operator Action<ILogMessage>(LogListener logListener)\n    {\n        return logListener.OnLogInternal;\n    }\n\n    private void OnLogInternal(ILogMessage logMessage)\n    {\n        if (!IsEnabled(logMessage))\n            return;\n\n        OnLog(logMessage);","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/core/Stride.Core/Diagnostics/LogListener.cs#L126-L162","documentation":"GetExceptionText extracts the exception text from a log message but only understands ILogMessage implementations carrying ExceptionInfo and the concrete LogMessage type carrying Exception. Passing any other object throws ArgumentException('Unsupported log message.') because no exception can be extracted.","triggerScenarios":"Calling LogListener.GetExceptionText (or the code path that uses it) with an object implementing ILogMessage that is neither the internal rich-message type nor LogMessage — e.g. a custom ILogMessage implementation or a wrapper/decorator message.","commonSituations":"Subscribing a custom Action<ILogMessage> or forwarding messages from another logging framework (custom adapters) into GetExceptionText; refactorings that introduced a new ILogMessage type without updating this helper.","solutions":["Only pass RichLogFileLogMessage-style messages (with ExceptionInfo) or LogMessage instances","Before calling, check the concrete type: if not LogMessage/rich message, read msg.Exception yourself or pass string.Empty","Implement ILogMessage via LogMessage (or expose ExceptionInfo) on your custom message type"],"exampleFix":"// before\nvar text = LogListener.GetExceptionText(myCustomMessage);\n// after\nvar text = myCustomMessage is LogMessage lm\n    ? LogListener.GetExceptionText(lm)\n    : (myCustomMessage.Exception?.ToString() ?? string.Empty);","handlingStrategy":"type-guard","validationCode":"if (msg is LogMessage || msg?.GetType().GetProperty(\"ExceptionInfo\") != null)\n    return LogListener.GetExceptionText(msg);","typeGuard":"bool hasExceptionText(ILogMessage m) =>\n    m is LogMessage || m.GetType().GetProperty(\"ExceptionInfo\") != null;","tryCatchPattern":"try { return LogListener.GetExceptionText(msg); }\ncatch (ArgumentException) { return msg?.Exception?.ToString() ?? string.Empty; }","preventionTips":["Only feed GetExceptionText messages created by Stride's logger","Implement custom ILogMessage types via LogMessage","Add a type check before calling with third-party/wrapped messages"],"tags":["logging","argumentexception","type-mismatch","ilogmessage"],"backgroundTag":"type-mismatch","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}