TimeoutExceptionとは? わかりやすく解説

TimeoutException クラス

指定したタイムアウト時間経過するスローされる例外

名前空間: System.ServiceProcess
アセンブリ: System.ServiceProcess (system.serviceprocess.dll 内)
構文構文

<SerializableAttribute> _
Public Class TimeoutException
    Inherits SystemException
Dim instance As TimeoutException
[SerializableAttribute] 
public class TimeoutException : SystemException
[SerializableAttribute] 
public ref class TimeoutException : public
 SystemException
/** @attribute SerializableAttribute() */ 
public class TimeoutException extends SystemException
SerializableAttribute 
public class TimeoutException extends
 SystemException
解説解説

TimeoutException クラスでは、例外原因説明するメッセージ指定できます通常、この例外メソッドによってスローされる場合は、"指定したタイムアウト経過したため、操作完了しませんでした。" などのメッセージ表示されます。

たとえば、このクラスは、ServiceController クラスの WaitForStatus メンバによって使用されます。サービスStatus プロパティPaused から ContinuePending変更するなどの操作を行うと、この例外スローされる可能性あります

継承階層継承階層
System.Object
   System.Exception
     System.SystemException
      System.ServiceProcess.TimeoutException
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TimeoutException メンバ
System.ServiceProcess 名前空間
WaitForStatus
ServiceController.Status プロパティ
ServiceController クラス
ServiceControllerStatus 列挙

TimeoutException クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

プロセスまたは操作用に割り当てられ時間経過したときにスローされる例外

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<SerializableAttribute> _
<ComVisibleAttribute(True)> _
Public Class TimeoutException
    Inherits SystemException
Dim instance As TimeoutException
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public class TimeoutException : SystemException
[SerializableAttribute] 
[ComVisibleAttribute(true)] 
public ref class TimeoutException : public
 SystemException
/** @attribute SerializableAttribute() */ 
/** @attribute ComVisibleAttribute(true) */ 
public class TimeoutException extends SystemException
SerializableAttribute 
ComVisibleAttribute(true) 
public class TimeoutException extends
 SystemException
解説解説

TimeoutException は、値 0x80131505 を保持する HRESULT, COR_E_TIMEOUT を使用します

TimeoutExceptionインスタンス初期プロパティ値の一覧については、TimeoutException コンストラクタトピック参照してください

使用例使用例

System.IO.Ports.SerialPort クラスメンバ組み合わせて TimeoutException使用するコード例次に示します

' This example demonstrates the use of the TimeoutException 
' exception in conjunction with the SerialPort class.

Imports System
Imports System.IO.Ports

Class Sample
   Public Shared Sub Main()
      Dim input As String
      Try
         ' Set the COM1 serial port to speed = 4800 baud, parity = odd,
 
         ' data bits = 8, stop bits = 1.
         Dim sp As New SerialPort("COM1",
 4800, Parity.Odd, 8, StopBits.One)

         ' Timeout after 2 seconds.
         sp.ReadTimeout = 2000
         sp.Open()
         
         ' Read until either the default newline termination string
 
         ' is detected or the read operation times out.
         input = sp.ReadLine()

         sp.Close()

         ' Echo the input.
         Console.WriteLine(input)
      
      ' Only catch timeout exceptions.
      Catch e As TimeoutException
         Console.WriteLine(e)
      End Try
   End Sub 'Main
End Class 'Sample
'
'This example produces the following results:
'
'(Data received at the serial port is echoed to the console if the 
'read operation completes successfully before the specified timeout
 period 
'expires. Otherwise, a timeout exception like the following is thrown.)
'
'System.TimeoutException: The operation has timed-out.
'   at System.IO.Ports.SerialStream.ReadByte(Int32 timeout)
'   at System.IO.Ports.SerialPort.ReadOneChar(Int32 timeout)
'   at System.IO.Ports.SerialPort.ReadTo(String value)
'   at System.IO.Ports.SerialPort.ReadLine()
'   at Sample.Main()
'
// This example demonstrates the use of the TimeoutException 
// exception in conjunction with the SerialPort class.

using System;
using System.IO.Ports;

class Sample 
{
    public static void Main()
 
    {
    string input;
    try 
        {
// Set the COM1 serial port to speed = 4800 baud, parity = odd, 
// data bits = 8, stop bits = 1.
        SerialPort sp = new SerialPort("COM1", 
                        4800, Parity.Odd, 8, StopBits.One); 
// Timeout after 2 seconds.
        sp.ReadTimeout = 2000;
        sp.Open();

// Read until either the default newline termination string 
// is detected or the read operation times out.
        input = sp.ReadLine();

        sp.Close();

// Echo the input.
        Console.WriteLine(input);
        }

// Only catch timeout exceptions.
    catch (TimeoutException e)
        {
        Console.WriteLine(e);
        }
    }
}
/*
This example produces the following results:

(Data received at the serial port is echoed to the console if
 the 
read operation completes successfully before the specified timeout period 
expires. Otherwise, a timeout exception like the following is thrown.)

System.TimeoutException: The operation has timed-out.
   at System.IO.Ports.SerialStream.ReadByte(Int32 timeout)
   at System.IO.Ports.SerialPort.ReadOneChar(Int32 timeout)
   at System.IO.Ports.SerialPort.ReadTo(String value)
   at System.IO.Ports.SerialPort.ReadLine()
   at Sample.Main()
*/
// This example demonstrates the use of the TimeoutException
// exception in conjunction with the SerialPort class.

#using <System.dll>

using namespace System;
using namespace System::IO::Ports;

int main()
{
    String^ input;
    try
    {
        // Set the COM1 serial port to speed = 4800 baud, parity = odd
,
        // data bits = 8, stop bits = 1.
        SerialPort^ port = gcnew SerialPort("COM1",
            4800, Parity::Odd, 8, StopBits::One);
        // Timeout after 2 seconds.
        port->ReadTimeout = 2000;
        port->Open();

        // Read until either the default newline termination string
        // is detected or the read operation times out.
        input = port->ReadLine();

        port->Close();

        // Echo the input.
        Console::WriteLine(input);
    }

    // Only catch timeout exceptions.
    catch (TimeoutException^ ex)
    {
        Console::WriteLine(ex);
    }
};
/*
This example produces the following results:

(Data received at the serial port is echoed to the console if
 the
read operation completes successfully before the specified timeout period
expires. Otherwise, a timeout exception like the following is thrown.)

System.TimeoutException: The operation has timed-out.
at System.IO.Ports.SerialStream.ReadByte(Int32 timeout)
at System.IO.Ports.SerialPort.ReadOneChar(Int32 timeout)
at System.IO.Ports.SerialPort.ReadTo(String value)
at System.IO.Ports.SerialPort.ReadLine()
at Sample.Main()
*/
// This example demonstrates the use of the TimeoutException 
// exception in conjunction with the SerialPort class.

import System.*;
import System.IO.Ports.*;

class Sample
{
    public static void main(String[]
 args)
    {
        String input;
        try {
            // Set the COM1 serial port to speed = 4800 baud, parity
 = odd, 
            // data bits = 8, stop bits = 1.
            SerialPort sp = new SerialPort("COM1", 4800,
 Parity.Odd, 8,
                StopBits.One);
            // Timeout after 2 seconds.
            sp.set_ReadTimeout(2000);
            sp.Open();
            // Read until either the default newline termination string
 
            // is detected or the read operation times out.
            input = sp.ReadLine();

            sp.Close();
            // Echo the input.
            Console.WriteLine(input);
        }
            // Only catch timeout exceptions.
        catch (TimeoutException e) {
            Console.WriteLine(e);
        }
    } //main
} //Sample

/*
This example produces the following results:

(Data received at the serial port is echoed to the console if
 the 
read operation completes successfully before the specified timeout period 
expires. Otherwise, a timeout exception like the following is thrown.)

System.TimeoutException: The operation has timed-out.
   at System.IO.Ports.SerialStream.ReadByte(Int32 timeout)
   at System.IO.Ports.SerialPort.ReadOneChar(Int32 timeout)
   at System.IO.Ports.SerialPort.ReadTo(String value)
   at System.IO.Ports.SerialPort.ReadLine()
   at Sample.main()
*/
継承階層継承階層
System.Object
   System.Exception
     System.SystemException
      System.TimeoutException
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

TimeoutException コンストラクタ ()

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

TimeoutException クラス新しインスタンス初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As New TimeoutException
public TimeoutException ()
public:
TimeoutException ()
public TimeoutException ()
public function TimeoutException ()
解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TimeoutException クラス
TimeoutException メンバ
System 名前空間

TimeoutException コンストラクタ ()


TimeoutException コンストラクタ (String)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

TimeoutException クラス新しインスタンスを、指定したエラー メッセージ使用して初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TimeoutException クラス
TimeoutException メンバ
System 名前空間

TimeoutException コンストラクタ (SerializationInfo, StreamingContext)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

シリアル化したデータ使用して、TimeoutException クラス新しインスタンス初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Protected Sub New ( _
    info As SerializationInfo, _
    context As StreamingContext _
)
Dim info As SerializationInfo
Dim context As StreamingContext

Dim instance As New TimeoutException(info,
 context)
protected TimeoutException (
    SerializationInfo info,
    StreamingContext context
)
protected:
TimeoutException (
    SerializationInfo^ info, 
    StreamingContext context
)
protected TimeoutException (
    SerializationInfo info, 
    StreamingContext context
)
protected function TimeoutException (
    info : SerializationInfo, 
    context : StreamingContext
)

パラメータ

info

スローされる例外に関するシリアル化されたオブジェクト データ格納する SerializationInfo オブジェクト

context

転送元または転送先に関す文脈情報格納する StreamingContext オブジェクトcontext パラメータは、今後使用するために予約されているため、null 参照 (Visual Basic では Nothing) として指定できます

例外例外
例外種類条件

ArgumentNullException

info パラメータnull 参照 (Visual Basic では Nothing) です。

SerializationException

クラス名null 参照 (Visual Basic では Nothing) であるか、HResult が 0 です。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TimeoutException クラス
TimeoutException メンバ
System 名前空間
SerializationInfo
StreamingContext
その他の技術情報
バイナリ シリアル化

TimeoutException コンストラクタ (String, Exception)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定したエラー メッセージ内部例外使用して、TimeoutException クラス新しインスタンス初期化します。

名前空間: System
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Public Sub New ( _
    message As String, _
    innerException As Exception _
)
Dim message As String
Dim innerException As Exception

Dim instance As New TimeoutException(message,
 innerException)
public TimeoutException (
    string message,
    Exception innerException
)
public:
TimeoutException (
    String^ message, 
    Exception^ innerException
)
public TimeoutException (
    String message, 
    Exception innerException
)
public function TimeoutException (
    message : String, 
    innerException : Exception
)

パラメータ

message

エラー説明するメッセージ

innerException

現在の例外の原因である例外innerException パラメータnull 参照 (Visual Basic では Nothing) でない場合は、内部例外処理する catch ブロック現在の例外が発生します

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TimeoutException クラス
TimeoutException メンバ
System 名前空間

TimeoutException コンストラクタ (String)

メッセージ テキスト指定して、TimeoutException クラス新しインスタンス初期化します。

名前空間: System.ServiceProcess
アセンブリ: System.ServiceProcess (system.serviceprocess.dll 内)
構文構文

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

TimeoutException コンストラクタ (SerializationInfo, StreamingContext)

指定したシリアル化情報コンテキスト使用して、TimeoutException クラス新しインスタンス初期化します。

名前空間: System.ServiceProcess
アセンブリ: System.ServiceProcess (system.serviceprocess.dll 内)
構文構文

Protected Sub New ( _
    info As SerializationInfo, _
    context As StreamingContext _
)
Dim info As SerializationInfo
Dim context As StreamingContext

Dim instance As New TimeoutException(info,
 context)
protected TimeoutException (
    SerializationInfo info,
    StreamingContext context
)
protected:
TimeoutException (
    SerializationInfo^ info, 
    StreamingContext context
)
protected TimeoutException (
    SerializationInfo info, 
    StreamingContext context
)
protected function TimeoutException (
    info : SerializationInfo, 
    context : StreamingContext
)

パラメータ

info

スローされている例外に関するシリアル化済みオブジェクト データ保持している SerializationInfo。

context

転送元または転送先に関すコンテキスト情報含んでいる StreamingContext。

例外例外
例外種類条件

ArgumentNullException

info パラメータnull 参照 (Visual Basic では Nothing) です。

SerializationException

クラス名null 参照 (Visual Basic では Nothing) であるか、または HResult が 0 です。

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

TimeoutException コンストラクタ (String, Exception)

メモ : このコンストラクタは、.NET Framework version 2.0新しく追加されたものです。

指定したメッセージ テキスト内部例外使用して、TimeoutException クラス新しインスタンス初期化します。

名前空間: System.ServiceProcess
アセンブリ: System.ServiceProcess (system.serviceprocess.dll 内)
構文構文

Public Sub New ( _
    message As String, _
    innerException As Exception _
)
Dim message As String
Dim innerException As Exception

Dim instance As New TimeoutException(message,
 innerException)
public TimeoutException (
    string message,
    Exception innerException
)
public:
TimeoutException (
    String^ message, 
    Exception^ innerException
)
public TimeoutException (
    String message, 
    Exception innerException
)
public function TimeoutException (
    message : String, 
    innerException : Exception
)

パラメータ

message

例外種類または原因説明するテキスト

innerException

現在の例外を引き起こした例外

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
TimeoutException クラス
TimeoutException メンバ
System.ServiceProcess 名前空間
InnerException

TimeoutException コンストラクタ


TimeoutException コンストラクタ


TimeoutException プロパティ


パブリック プロパティパブリック プロパティ

プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HResult  特定の例外割り当てられているコード化数値である HRESULT を取得または設定します。 ( Exception から継承されます。)
参照参照

関連項目

TimeoutException クラス
System.ServiceProcess 名前空間
WaitForStatus
ServiceController.Status プロパティ
ServiceController クラス
ServiceControllerStatus 列挙

TimeoutException プロパティ


パブリック プロパティパブリック プロパティ

プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HResult  特定の例外割り当てられているコード化数値である HRESULT を取得または設定します。 ( Exception から継承されます。)
参照参照

関連項目

TimeoutException クラス
System 名前空間
Exception クラス

その他の技術情報

例外の処理とスロー

TimeoutException メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

TimeoutException クラス
System.ServiceProcess 名前空間
WaitForStatus
ServiceController.Status プロパティ
ServiceController クラス
ServiceControllerStatus 列挙

TimeoutException メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

TimeoutException クラス
System 名前空間
Exception クラス

その他の技術情報

例外の処理とスロー

TimeoutException メンバ

指定したタイムアウト時間経過するスローされる例外

TimeoutException データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
プロテクト コンストラクタプロテクト コンストラクタ
パブリック プロパティパブリック プロパティ
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HResult  特定の例外割り当てられているコード化数値である HRESULT を取得または設定します。(Exception から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

TimeoutException クラス
System.ServiceProcess 名前空間
WaitForStatus
ServiceController.Status プロパティ
ServiceController クラス
ServiceControllerStatus 列挙

TimeoutException メンバ

プロセスまたは操作用に割り当てられ時間経過したときにスローされる例外

TimeoutException データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
プロテクト コンストラクタプロテクト コンストラクタ
パブリック プロパティパブリック プロパティ
プロテクト プロパティプロテクト プロパティ
  名前 説明
プロテクト プロパティ HResult  特定の例外割り当てられているコード化数値である HRESULT を取得または設定します。(Exception から継承されます。)
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

TimeoutException クラス
System 名前空間
Exception クラス

その他の技術情報

例外の処理とスロー



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「TimeoutException」の関連用語

TimeoutExceptionのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



TimeoutExceptionのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS