So I've been mostly going off of this post How to populate the 'Code' field of the VS 2022 Error List when writing a VS Extension? to figure out how to populate the code field for error list window, but I have not been successful. How I approached adding error messages is identical to the post in the link above. Going off of the answer and comments to that post, I created a custom error that inherits ITableEntry and ErrorTask and copied the code the answer with the green checkmark had. I mainly tried this along other variations of this but still have not been able to get it to work. Was wondering how I could get this to work if possible at all. My current custom error code looks like:
public class CustomError : ErrorTask, ITableEntry { public object Identity => throw new NotImplementedException(); public string errorCode { get; set; } public bool TrySetValue(string keyName, object content) { throw new NotImplementedException(); } public bool TryGetValue(string keyName, out object content) { switch (keyName) { case StandardTableKeyNames.ErrorCode: content = errorCode; return true; default: content = ""; return false; } } public bool CanSetValue(string keyName) { switch (keyName) { case StandardTableKeyNames.ErrorCode: return true; default: return false; } } } and how I add it to Error List window using Error List Provider looks like:
var error = new CustomError() { Category = TaskCategory.BuildCompile, ErrorCategory = errorCategory, Text = message, Document = filePath, HierarchyItem = hierarchy, errorCode = "test" }; _errorListProvider?.Tasks.Add(error); _errorTasks.Add(error); _errorListProvider?.Show();