InternalBufferOverflowException 클래스

정의

내부 버퍼가 오버플로될 때 throw되는 예외입니다.The exception thrown when the internal buffer overflows.

public ref class InternalBufferOverflowException : SystemException
public class InternalBufferOverflowException : SystemException
[System.Serializable]
public class InternalBufferOverflowException : SystemException
type InternalBufferOverflowException = class
    inherit SystemException
[<System.Serializable>]
type InternalBufferOverflowException = class
    inherit SystemException
Public Class InternalBufferOverflowException
Inherits SystemException
상속
InternalBufferOverflowException
특성

예제

다음 예제에는 파일 변경을 모니터링 하려면 FileSystemWatcher를 만드는 방법을 보여 줍니다 (만듭니다, 삭제, 이름 바꾸기, 변경 내용) 디스크 드라이브에 발생 합니다.The following example shows how to create a FileSystemWatcher to monitor file changes (creates, deletes, renames, changes) occurring on a disk drive. 이 예제에는 오류 알림을 받는 방법을 보여 줍니다.The example also shows how to properly receive error notifications.

using System;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        //  Create a FileSystemWatcher to monitor all files on drive C.
        FileSystemWatcher fsw = new FileSystemWatcher("C:\\");

        //  Watch for changes in LastAccess and LastWrite times, and
        //  the renaming of files or directories.
        fsw.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
            | NotifyFilters.FileName |NotifyFilters.DirectoryName;

        //  Register a handler that gets called when a
        //  file is created, changed, or deleted.
        fsw.Changed += new FileSystemEventHandler(OnChanged);

        fsw.Created += new FileSystemEventHandler(OnChanged);

        fsw.Deleted += new FileSystemEventHandler(OnChanged);

        //  Register a handler that gets called when a file is renamed.
        fsw.Renamed += new RenamedEventHandler(OnRenamed);

        //  Register a handler that gets called if the
        //  FileSystemWatcher needs to report an error.
        fsw.Error += new ErrorEventHandler(OnError);

        //  Begin watching.
        fsw.EnableRaisingEvents = true;

        Console.WriteLine("Press \'Enter\' to quit the sample.");
        Console.ReadLine();
    }

    //  This method is called when a file is created, changed, or deleted.
    private static void OnChanged(object source, FileSystemEventArgs e)
    {
        //  Show that a file has been created, changed, or deleted.
        WatcherChangeTypes wct = e.ChangeType;
        Console.WriteLine("File {0} {1}", e.FullPath, wct.ToString());
    }

    //  This method is called when a file is renamed.
    private static void OnRenamed(object source, RenamedEventArgs e)
    {
        //  Show that a file has been renamed.
        WatcherChangeTypes wct = e.ChangeType;
        Console.WriteLine("File {0} {2} to {1}", e.OldFullPath, e.FullPath, wct.ToString());
    }

    //  This method is called when the FileSystemWatcher detects an error.
    private static void OnError(object source, ErrorEventArgs e)
    {
        //  Show that an error has been detected.
        Console.WriteLine("The FileSystemWatcher has detected an error");
        //  Give more information if the error is due to an internal buffer overflow.
        if (e.GetException().GetType() == typeof(InternalBufferOverflowException))
        {
            //  This can happen if Windows is reporting many file system events quickly
            //  and internal buffer of the  FileSystemWatcher is not large enough to handle this
            //  rate of events. The InternalBufferOverflowException error informs the application
            //  that some of the file system events are being lost.
            Console.WriteLine(("The file system watcher experienced an internal buffer overflow: " + e.GetException().Message));
        }
    }
}
Imports System.IO

Module Module1
    Sub Main()
        ' Create a FileSystemWatcher to monitor all files on drive C.
        Dim fsw As New FileSystemWatcher("C:\")

        ' Watch for changes in LastAccess and LastWrite times, and
        ' the renaming of files or directories. 
        fsw.NotifyFilter = (NotifyFilters.LastAccess Or NotifyFilters.LastWrite _ 
            Or NotifyFilters.FileName Or NotifyFilters.DirectoryName)

        ' Register a handler that gets called when a 
        ' file is created, changed, or deleted.
        AddHandler fsw.Changed, New FileSystemEventHandler(AddressOf OnChanged)

        ' The commented line of code below is a shorthand of the above line.
        ' AddHandler fsw.Changed, AddressOf OnChanged

        ' NOTE: The shorthand version is used in the remainder of this code.
        ' FileSystemEventHandler
        AddHandler fsw.Created, AddressOf OnChanged 
        ' FileSystemEventHandler
        AddHandler fsw.Deleted, AddressOf OnChanged

        ' Register a handler that gets called when a file is renamed.
        ' RenamedEventHandler
        AddHandler fsw.Renamed, AddressOf OnRenamed

        ' Register a handler that gets called if the 
        ' FileSystemWatcher needs to report an error.
        ' ErrorEventHandler
        AddHandler fsw.Error, AddressOf OnError

        ' Begin watching.
        fsw.EnableRaisingEvents = True

        ' Wait for the user to quit the program.
        Console.WriteLine("Press 'Enter' to quit the sample.")
        Console.ReadLine()
    End Sub

    ' This method is called when a file is created, changed, or deleted.
    Private Sub OnChanged(ByVal source As Object, ByVal e As FileSystemEventArgs)

        ' Show that a file has been created, changed, or deleted.
        Dim wct As WatcherChangeTypes = e.ChangeType
        Console.WriteLine("File {0} {1}", e.FullPath, wct.ToString())
    End Sub

    ' This method is called when a file is renamed.
    Private Sub OnRenamed(ByVal source As Object, ByVal e As RenamedEventArgs)

        ' Show that a file has been renamed.
        Dim wct As WatcherChangeTypes = e.ChangeType
        Console.WriteLine("File {0} {2} to {1}", e.OldFullPath, e.FullPath, wct.ToString())
    End Sub

    ' This method is called when the FileSystemWatcher detects an error.
    Private Sub OnError(ByVal source As Object, ByVal e As ErrorEventArgs)

        ' Show that an error has been detected.
        Console.WriteLine("The FileSystemWatcher has detected an error")

        ' Give more information if the error is due to an internal buffer overflow.
        If TypeOf e.GetException Is InternalBufferOverflowException Then
            ' This can happen if Windows is reporting many file system events quickly 
            ' and internal buffer of the  FileSystemWatcher is not large enough to handle this
            ' rate of events. The InternalBufferOverflowException error informs the application
            ' that some of the file system events are being lost.
            Console.WriteLine( _
                "The file system watcher experienced an internal buffer overflow: " _
                + e.GetException.Message)
        End If
    End Sub
End Module

설명

FileSystemWatcher알림이 변경 파일 시스템 저장소 버퍼 구성 요소에에서 변경 사항을 만들고 애플리케이션 프로그래밍 인터페이스 (Api)에 전달 하는 경우.In a FileSystemWatcher, when you are notified of file changes, the system stores those changes in a buffer the component creates and passes to the Application Programming Interfaces (APIs). 짧은 시간에 많은 변경 내용이 있는 경우 버퍼를 쉽게 오버플로 하 여 예외가 throw 되 면 기본적으로 모든 변경 내용을 잃게 됩니다.If there are many changes in a short time, the buffer can easily overflow, resulting in an exception being thrown, which essentially loses all changes. 버퍼의 오버플로를 방지 하려면 및 속성을 사용 하 여 FileSystemWatcher.NotifyFilter FileSystemWatcher.IncludeSubdirectories 원치 않는 변경 알림을 필터링 합니다.To keep the buffer from overflowing, use the FileSystemWatcher.NotifyFilter and FileSystemWatcher.IncludeSubdirectories properties to filter out your unwanted change notifications. 또한 속성을 통해 내부 버퍼의 크기를 늘릴 수 있습니다 FileSystemWatcher.InternalBufferSize .You can also increase the size of the internal buffer through the FileSystemWatcher.InternalBufferSize property. 그러나 버퍼의 크기를 늘릴 때 비용이 많이 들기 때문에 버퍼를 가능한 한 작게 유지 합니다.However, increasing the size of the buffer is expensive, so keep the buffer as small as possible.

생성자

InternalBufferOverflowException()

InternalBufferOverflowException 클래스의 새 기본 인스턴스를 초기화합니다.Initializes a new default instance of the InternalBufferOverflowException class.

InternalBufferOverflowException(SerializationInfo, StreamingContext)

지정된 InternalBufferOverflowExceptionSerializationInfo 개체를 사용하여 serialize할 수 있는 StreamingContext 클래스의 비어 있는 새 인스턴스를 초기화합니다.Initializes a new, empty instance of the InternalBufferOverflowException class that is serializable using the specified SerializationInfo and StreamingContext objects.

InternalBufferOverflowException(String)

표시될 오류 메시지를 지정한 상태에서 InternalBufferOverflowException 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the InternalBufferOverflowException class with the error message to be displayed specified.

InternalBufferOverflowException(String, Exception)

표시될 메시지 및 생성되는 내부 예외를 지정한 상태에서 InternalBufferOverflowException 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the InternalBufferOverflowException class with the message to be displayed and the generated inner exception specified.

속성

Data

예외에 대한 사용자 정의 정보를 추가로 제공하는 키/값 쌍 컬렉션을 가져옵니다.Gets a collection of key/value pairs that provide additional user-defined information about the exception.

(다음에서 상속됨 Exception)
HelpLink

이 예외와 연결된 도움말 파일에 대한 링크를 가져오거나 설정합니다.Gets or sets a link to the help file associated with this exception.

(다음에서 상속됨 Exception)
HResult

특정 예외에 할당된 코드화된 숫자 값인 HRESULT를 가져오거나 설정합니다.Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.

(다음에서 상속됨 Exception)
InnerException

현재 예외를 발생시킨 Exception 인스턴스를 가져옵니다.Gets the Exception instance that caused the current exception.

(다음에서 상속됨 Exception)
Message

현재 예외를 설명하는 메시지를 가져옵니다.Gets a message that describes the current exception.

(다음에서 상속됨 Exception)
Source

오류를 발생시키는 애플리케이션 또는 개체의 이름을 가져오거나 설정합니다.Gets or sets the name of the application or the object that causes the error.

(다음에서 상속됨 Exception)
StackTrace

호출 스택의 직접 실행 프레임 문자열 표현을 가져옵니다.Gets a string representation of the immediate frames on the call stack.

(다음에서 상속됨 Exception)
TargetSite

현재 예외를 throw하는 메서드를 가져옵니다.Gets the method that throws the current exception.

(다음에서 상속됨 Exception)

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.Determines whether the specified object is equal to the current object.

(다음에서 상속됨 Object)
GetBaseException()

파생 클래스에서 재정의된 경우 하나 이상의 후속 예외의 근본 원인이 되는 Exception 을 반환합니다.When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.

(다음에서 상속됨 Exception)
GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(다음에서 상속됨 Object)
GetObjectData(SerializationInfo, StreamingContext)

파생 클래스에서 재정의된 경우 예외에 관한 정보를 SerializationInfo 에 설정합니다.When overridden in a derived class, sets the SerializationInfo with information about the exception.

(다음에서 상속됨 Exception)
GetType()

현재 인스턴스의 런타임 형식을 가져옵니다.Gets the runtime type of the current instance.

(다음에서 상속됨 Exception)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(다음에서 상속됨 Object)
ToString()

현재 예외에 대한 문자열 표현을 만들고 반환합니다.Creates and returns a string representation of the current exception.

(다음에서 상속됨 Exception)

이벤트

SerializeObjectState

예외에 대한 serialize된 데이터가 들어 있는 예외 상태 개체가 만들어지도록 예외가 serialize될 때 발생합니다.Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception.

(다음에서 상속됨 Exception)

적용 대상

추가 정보