During investigating the issue in another repository, I've identified the problem there. (or can be somewhere deeper inside VS)
The constructor ActiveFrameChangeEventArgs(IVsWindowFrame oldFrame, IVsWindowFrame newFrame) calls constructors for WindowFrame(IVsWindowFrame frame) and these in turn calls SetProperty(-3011, this) later invoking NotifyPropertyChanged("ViewHelper") in original WindowFrame possibly messing other things during Window initialization. My investigation ended here, I didn't went further.
Anyway, I was able to reproduce the bug with calling WindowFrame(IVsWindowFrame frame) myself.
VS.Events.WindowEvents.FrameIsVisibleChanged += args =>
{
_ = new WindowFrame(args.Frame);
}
Is it possible to not create new instances and reuse the old ones when they are already WindowFrame?