This documentation is archived and is not being maintained.

Troubleshooting Exceptions: System.IO.InternalBufferOverflowException

An InternalBufferOverflowException exception is thrown when the internal buffer overflows.

When using FileSystemWatcher, filter out unwanted change notifications.

In a file-system watcher, when you are notified of file changes, the system stores those changes in a buffer that the component creates and passes to the application programming interfaces (APIs). If there are many changes in a short time, the buffer can overflow, resulting in an InternalBufferOverflowException exception, which loses all changes. To keep the buffer from overflowing, use the NotifyFilter and IncludeSubdirectories properties to filter out unwanted change notifications. For more information, see FileSystemWatcher.

You can also increase the size of the internal buffer through the InternalBufferSize property. However, increasing the size of the buffer will affect performance, so it is best to keep the buffer as small as possible.