For previous versions of VS there were some ways to get the description of the error programmatically, that no longer work for Visual Studio 2015. I'm able to get the list of ALL the errors using some code like:
dynamic selection = window.Selection;
dynamic errItems = selection.ErrorItems;
IEnumerable ienum = errItems as IEnumerable;
var enumerator = ienum.GetEnumerator();
while (enumerator.MoveNext())
{
var first = enumerator.Current;
dynamic dfirst = enumerator.Current;
object objerr = first.GetType().GetProperty("Description",typeof(string)).GetValue(first, null);
// PropertyInfo pi = first.GetType().GetProperty("Entry");//pi is null
dynamic dfirst = enumerator.Current;
// dynamic dentr = dfirst.Entry;//keeps throwing Binder exception
}
My issue is that the "Entry" Property holds another property called "IsSelected
" that I'm looking for and I can not reach, as you can see in the commented code above. Both dynamic and Reflection failed for me.
According to the debugger that Entry property is of type Microsoft.VisualStudio.Shell.TableControl.Implementation.SnapshotTableEntryViewModel
that is undocumented and most likely internal to VS 2015.
How can I ca access Entry and IsSelected
properties, or is there another workaround to get the description for the selected error only?