// UI thread
        public override IHexBufferInfo CreateBuffer()
        {
            uiDispatcher.VerifyAccess();
            var debuggerHexBufferStream = new DebuggerHexBufferStream();
            var buffer      = hexBufferFactoryService.Create(debuggerHexBufferStream, hexBufferFactoryService.DefaultMemoryTags, disposeStream: true);
            var bufferState = new BufferState(buffer, debuggerHexBufferStream);

            bufferStates.Add(bufferState);
            buffer.Disposed           += Buffer_Disposed;
            buffer.ChangedLowPriority += Buffer_ChangedLowPriority;
            var info = processInfos.FirstOrDefault();

            bufferState.SetUnderlyingStream(info?.Stream, info?.Process);
            HexBufferInfoCreated?.Invoke(this, new HexBufferInfoCreatedEventArgs(bufferState));
            return(bufferState);
        }
 public void InvalidateSpan(NormalizedHexChangeCollection changes) => DebuggerHexBufferStream.Invalidate(changes);
 public BufferState(HexBuffer buffer, DebuggerHexBufferStream debuggerHexBufferStream)
 {
     Buffer = buffer ?? throw new ArgumentNullException(nameof(buffer));
     DebuggerHexBufferStream = debuggerHexBufferStream ?? throw new ArgumentNullException(nameof(debuggerHexBufferStream));
 }