I confirm there is a bug with DTE2.Documents
. I jumped to the latest 2022 from 2019. I use a plugin that fixes line endings on save. The plugin is officially for 2019, but a fellow developer has made a 2022 version here: https://github.com/silkfire/LineEndingsUnifier
I installed it, but it didn't work, so I debugged it. Long story short, on save it calls this line:
foreach (Document document in Ide.Documents)
{
...
}
Ide.Documents
(Ide
is the DTE2
interface) throws the same exception:
The data necessary to complete this operation is not yet available. (Exception from HRESULT: 0x8000000A)
The DTE2 interface is obtained lazily on demand so it should be ok.
You can reproduce the bug easily by download the plugin, run the solution, test it by saving any C# file inside the started Visual Studio.
This happens with VS 17.7.3. I've installed VS 17.6.6 and it works fine there. Tried the preview 17.8.0, but it is still broken. So this is a new bug that came this august.
Was not sure if you reported the bug to the VS forum, so I did it just in case: https://developercommunity.visualstudio.com/t/DTE2Documents-Exception-0x8000000A/10457457?