Custom Debug log double click breaks sollution


I am trying to make a custom Logger class. I am however running into an issue.

By default when you double click a message in the console, it will open up visual studio and show you where the specific log was tossed. However, when I create a custom log as shown in the code below, when I double click the log, it sometimes does nothing, but sometimes it does open visual studio, but breaks the sollution. I then have to reopen visual studio through [Assets => Open C# Project] to fix the sollution.

        public static void LogToConsole(object _message, [CallerFilePath] string _sourceFilePath = "", [CallerLineNumber] int _sourceLineNumber = 0)
            //Add script hyperlink to the message
            _message += "\r\n(at <a href=\"" + _sourceFilePath + "\" line=\"" + _sourceLineNumber + "\">" + _sourceFilePath + ":" + _sourceLineNumber + "</a>)";

            //Log the message to the console without default stacktrace
            Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None);
            Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.ScriptOnly);

My question is thus simple.
Is there a way to fix this double click behavior so that it acts in a similar way as the default?

Thanks! :)


Did you find the solution ?