static unsafe MonoObject *CreateException(ExceptionType type, IntPtr arg0) { Exception rv = null; var str0 = Marshal.PtrToStringAuto(arg0); switch (type) { case ExceptionType.System_Exception: rv = new System.Exception(str0); break; case ExceptionType.System_InvalidCastException: rv = new System.InvalidCastException(str0); break; case ExceptionType.System_EntryPointNotFoundException: rv = new System.EntryPointNotFoundException(str0); break; case ExceptionType.System_OutOfMemoryException: rv = new System.OutOfMemoryException(); break; default: throw new ArgumentOutOfRangeException(nameof(type)); } return((MonoObject *)GetMonoObject(rv)); }
public static void Ctor_String() { string message = "Created EntryPointNotFoundException"; var exception = new EntryPointNotFoundException(message); Assert.Equal(message, exception.Message); Assert.Equal(COR_E_ENTRYPOINTNOTFOUND, exception.HResult); }
public static void Ctor_Empty() { var exception = new EntryPointNotFoundException(); Assert.NotNull(exception); Assert.NotEmpty(exception.Message); Assert.NotNull(exception.ToString()); Assert.Equal(COR_E_ENTRYPOINTNOTFOUND, exception.HResult); }
public static void Ctor_String_Exception() { string message = "Created EntryPointNotFoundException"; var innerException = new Exception("Created inner exception"); var exception = new EntryPointNotFoundException(message, innerException); Assert.Equal(message, exception.Message); Assert.Equal(exception.GetBaseException().Message, "Created inner exception"); Assert.Equal(COR_E_ENTRYPOINTNOTFOUND, exception.HResult); Assert.Equal(innerException, exception.InnerException); Assert.Equal(innerException.HResult, exception.InnerException.HResult); }
public void MyTestMethod() { EntryPointNotFoundException entryPointNotFoundException = new EntryPointNotFoundException(); StringBuilder builder = new StringBuilder(); builder.ToString().Split(",".ToCharArray()); var fileName = ""; Stream stream = new FileStream(fileName, FileMode.Open); StreamReader reader = new StreamReader(stream); EntryPointNotFoundException exception = new EntryPointNotFoundException(fileName); Stream inputStream = File.OpenRead(fileName); }