MissingMethodException クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<SerializableAttribute> _ <ComVisibleAttribute(True)> _ Public Class MissingMethodException Inherits MissingMemberException Implements ISerializable
[SerializableAttribute] [ComVisibleAttribute(true)] public class MissingMethodException : MissingMemberException, ISerializable
[SerializableAttribute] [ComVisibleAttribute(true)] public ref class MissingMethodException : public MissingMemberException, ISerializable

通常、存在しないクラス メソッドにコードでアクセスしようとすると、コンパイル エラーが生成されます。MissingMethodException は、厳密な名前で参照されていないアセンブリの、名前変更または削除されたメソッドに動的にアクセスしようとした場合に対処するために用意されています。MissingMethodException は、変更されたアセンブリの存在しないメソッドに、従属するアセンブリのコードがアクセスしようとした場合にスローされます。
MissingMethodException は、値 0x80131513 を保持する HRESULT COR_E_MISSINGMETHOD を使用します。
MissingMethodException のインスタンスの初期プロパティ値の一覧については、MissingMethodException コンストラクタのトピックを参照してください。

この例では、リフレクションを使用して存在しないメソッドを呼び出そうとしたか、または存在しないフィールドにアクセスしようとした場合の動作を示します。このアプリケーションは、MissingMethodException、MissingFieldException、および MissingMemberException をキャッチして回復します。
using System; using System.Reflection; public class App { public static void Main() { try { // Attempt to call a static DoSomething method defined in the App class. // However, because the App class does not define this field, // a MissingFieldException is thrown. typeof(App).InvokeMember("DoSomething", BindingFlags.Static | BindingFlags.InvokeMethod, null, null, null); } catch (MissingMethodException e) { // Show the user that the DoSomething method cannot be called. Console.WriteLine("Unable to call the DoSomething method: {0}", e.Message); } try { // Attempt to access a static AField field defined in the App class. // However, because the App class does not define this field, // a MissingFieldException is thrown. typeof(App).InvokeMember("AField", BindingFlags.Static | BindingFlags.SetField, null, null, new Object[] { 5 }); } catch (MissingFieldException e) { // Show the user that the AField field cannot be accessed. Console.WriteLine("Unable to access the AField field: {0}", e.Message); } try { // Attempt to access a static AnotherField field defined in the App class. // However, because the App class does not define this field, // a MissingFieldException is thrown. typeof(App).InvokeMember("AnotherField", BindingFlags.Static | BindingFlags.GetField, null, null, null); } catch (MissingMemberException e) { // Notice that this code is catching MissingMemberException which is the // base class of MissingMethodException and MissingFieldException. // Show the user that the AnotherField field cannot be accessed. Console.WriteLine("Unable to access the AnotherField field: {0}", e.Message); } } } // This code produces the following output. // // Unable to call the DoSomething method: Method 'App.DoSomething' not found. // Unable to access the AField field: Field 'App.AField' not found. // Unable to access the AnotherField field: Field 'App.AnotherField' not found.
using namespace System; using namespace System::Reflection; ref class App { }; int main() { try { // Attempt to call a static DoSomething method defined in the App class. // However, because the App class does not define this field, // a MissingFieldException is thrown. App::typeid->InvokeMember("DoSomething", BindingFlags::Static | BindingFlags::InvokeMethod, nullptr, nullptr, nullptr); } catch (MissingMethodException^ ex) { // Show the user that the DoSomething method cannot be called. Console::WriteLine("Unable to call the DoSomething method: {0}", ex->Message); } try { // Attempt to access a static AField field defined in the App class. // However, because the App class does not define this field, // a MissingFieldException is thrown. App::typeid->InvokeMember("AField", BindingFlags::Static | BindingFlags::SetField, nullptr, nullptr, gcnew array<Object^>{5}); } catch (MissingFieldException^ ex) { // Show the user that the AField field cannot be accessed. Console::WriteLine("Unable to access the AField field: {0}", ex->Message); } try { // Attempt to access a static AnotherField field defined in the App class. // However, because the App class does not define this field, // a MissingFieldException is thrown. App::typeid->InvokeMember("AnotherField", BindingFlags::Static | BindingFlags::GetField, nullptr, nullptr, nullptr); } catch (MissingMemberException^ ex) { // Notice that this code is catching MissingMemberException which is the // base class of MissingMethodException and MissingFieldException. // Show the user that the AnotherField field cannot be accessed. Console::WriteLine("Unable to access the AnotherField field: {0}", ex->Message); } } // This code produces the following output. // // Unable to call the DoSomething method: Method 'App.DoSomething' not found. // Unable to access the AField field: Field 'App.AField' not found. // Unable to access the AnotherField field: Field 'App.AnotherField' not found.

System.Exception
System.SystemException
System.MemberAccessException
System.MissingMemberException
System.MissingMethodException


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からMissingMethodException クラスを検索する場合は、下記のリンクをクリックしてください。

- MissingMethodException クラスのページへのリンク