'IVsSccGlyphs doesn't load custom predefined glyphs into project on VS2022 with newest interop libraries
So recently I have updated one of my project, that's basically a GIT alike project, to newer interop libraries so that plugin can be installed on VS2022 and when I install that plugin on VS2022 my custom icons I have for file statuses in solution explorer are not showed up and instead of those custom, in solution explorer I can see only those predefined icons.
example of embedded statuses for icons
And if I do the same thing with the same interop updates on VS2019, than I'm able to see all my custom icons, so does anyone has any idea why is this happening. As I saw, that job to upload new custom icons is in hand of IVsSccGlyphs interface, specifically in hand of GetCustomGlyphList method, that doesn't work on VS2022.
My implementation of this method is below.
public int GetCustomGlyphList(uint BaseIndex, out IntPtr pdwImageListHandle)
{
try
{
if (Glyphs != null && BaseIndex != BaseImageIdx)
{
Glyphs.Dispose();
Glyphs = null;
}
// We give VS all our custom glyphs from baseindex upwards
if (Glyphs == null)
{
BaseImageIdx = BaseIndex;
if (BaseIndex == 0)
{
Glyphs = P4SolutionExplorer.CustomGlyphs;
}
else
{
Glyphs = P4SolutionExplorer.CustomGlyphsLongList;
}
}
pdwImageListHandle = unchecked(Glyphs.Handle);
return VSConstants.S_OK;
}
catch (Exception)
{
pdwImageListHandle = (IntPtr)0;
return VSConstants.S_FALSE;
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
