// TODO: move to a place where we can share this with the compiler private static string GetFormatString(ExceptionStringID id) { switch (id) { case ExceptionStringID.ClassLoadGeneral: return SR.ClassLoad_General; case ExceptionStringID.ClassLoadExplicitGeneric: return SR.ClassLoad_ExplicitGeneric; case ExceptionStringID.ClassLoadBadFormat: return SR.ClassLoad_BadFormat; case ExceptionStringID.ClassLoadValueClassTooLarge: return SR.ClassLoad_ValueClassTooLarge; case ExceptionStringID.ClassLoadExplicitLayout: return SR.ClassLoad_ExplicitLayout; case ExceptionStringID.InvalidProgramSpecific: return SR.InvalidProgram_Specific; case ExceptionStringID.InvalidProgramVararg: return SR.InvalidProgram_Vararg; case ExceptionStringID.MissingField: return SR.EE_MissingField; case ExceptionStringID.MissingMethod: return SR.EE_MissingMethod; case ExceptionStringID.FileLoadErrorGeneric: return SR.IO_FileNotFound_FileName; default: Debug.Assert(false); throw new NotImplementedException(); } }
public InvalidProgramException(ExceptionStringID id, MethodDesc method) : base(id, Format.Method(method)) { }
public MissingFieldException(ExceptionStringID id, params string[] args) : base(id, args) { }
protected internal MissingMemberException(ExceptionStringID id, params string[] args) : base(id, args) { }
private TypeLoadException(ExceptionStringID id, string typeName, string assemblyName) : base(id, new string[] { typeName, assemblyName }) { TypeName = typeName; AssemblyName = assemblyName; }
public FileNotFoundException(ExceptionStringID id, string fileName) : base(id, fileName) { }
public static Exception CreateFileNotFoundException(ExceptionStringID id, string fileName) { throw new System.IO.FileNotFoundException(SR.Format(GetFormatString(id), fileName), fileName); }
public static Exception CreateBadImageFormatException(ExceptionStringID id) { return(new BadImageFormatException(GetFormatString(id))); }
public static void ThrowTypeLoadExceptionWithArgument(ExceptionStringID id, string className, string typeName, string messageArg) { throw TypeLoaderExceptionHelper.CreateTypeLoadException(id, className, typeName, messageArg); }
public static void ThrowTypeLoadException(ExceptionStringID id, string className, string typeName) { throw TypeLoaderExceptionHelper.CreateTypeLoadException(id, className, typeName); }
public static Exception CreateInvalidProgramException(ExceptionStringID id, string methodName) { throw new InvalidProgramException(SR.Format(GetFormatString(id), methodName)); }
public static Exception CreateMissingMethodException(ExceptionStringID id, string methodName) { throw new MissingMethodException(SR.Format(GetFormatString(id), methodName)); }
private static string GetExceptionString(ExceptionStringID id, string[] args) { // TODO: Share the strings and lookup logic with System.Private.CoreLib. return "[TEMPORARY EXCEPTION MESSAGE] " + id.ToString() + ": " + String.Join(", ", args); }
public static void ThrowMissingMethodException(ExceptionStringID id, string methodName) { throw TypeLoaderExceptionHelper.CreateMissingMethodException(id, methodName); }
public TypeLoadException(ExceptionStringID id, MethodDesc method) : this(id, Format.Type(method.OwningType), Format.Module(GetOwningModule(method)), Format.Method(method)) { }
public static void ThrowMissingFieldException(ExceptionStringID id, string fieldName) { throw TypeLoaderExceptionHelper.CreateMissingFieldException(id, fieldName); }
public static Exception CreateMissingFieldException(ExceptionStringID id, string fieldName) { return(new MissingFieldException(SR.Format(GetFormatString(id), fieldName))); }
public static void ThrowFileNotFoundException(ExceptionStringID id, string fileName) { throw TypeLoaderExceptionHelper.CreateFileNotFoundException(id, fileName); }
public TypeLoadException(ExceptionStringID id, TypeDesc type, string messageArg) : this(id, Format.Type(type), Format.OwningModule(type), messageArg) { }
public static void ThrowInvalidProgramException(ExceptionStringID id, string methodName) { throw TypeLoaderExceptionHelper.CreateInvalidProgramException(id, methodName); }
public TypeSystemException(ExceptionStringID id, params string[] args) { StringID = id; _arguments = args; }
public static void ThrowTypeLoadException(ExceptionStringID id, MethodDesc method) { ThrowTypeLoadException(id, Format.Type(method.OwningType), Format.OwningModule(method), Format.Method(method)); }
public static Exception CreateMissingFieldException(ExceptionStringID id, string fieldName) { return new MissingFieldException(SR.Format(GetFormatString(id), fieldName)); }
public TypeLoadException(ExceptionStringID id, TypeDesc type) : this(id, Format.Type(type), Format.OwningModule(type)) { }
public TypeLoadException(ExceptionStringID id, string typeName, string assemblyName, string messageArg = null) : base(id, new string[] { typeName, assemblyName, messageArg }) { TypeName = typeName; AssemblyName = assemblyName; }
public static Exception CreateTypeLoadException(ExceptionStringID id, string typeName, string moduleName, string messageArg) { return(new TypeLoadException(SR.Format(GetFormatString(id), typeName, moduleName, messageArg), typeName)); }
public static string GetFormatString(ExceptionStringID id) { return(s_stringResourceManager.Value.GetString(id.ToString(), CultureInfo.InvariantCulture)); }
public static Exception CreateInvalidProgramException(ExceptionStringID id) { throw new InvalidProgramException(GetFormatString(id)); }
public static Exception CreateMarshalDirectiveException(ExceptionStringID id) { throw new MarshalDirectiveException(GetFormatString(id)); }
internal MissingFieldException(ExceptionStringID id, params string[] args) : base(id, args) { }
internal FileNotFoundException(ExceptionStringID id, string fileName) : base(id, fileName) { }
private static string GetExceptionString(ExceptionStringID id, string[] args) { // TODO: Share the strings and lookup logic with System.Private.CoreLib. return("[TEMPORARY EXCEPTION MESSAGE] " + id.ToString() + ": " + String.Join(", ", args)); }
internal InvalidProgramException(ExceptionStringID id, string method) : base(id, method) { }
public TypeLoadException(ExceptionStringID id, MethodDesc method) : this(id, Format.Type(method.OwningType), Format.OwningModule(method), Format.Method(method)) { }
internal InvalidProgramException(ExceptionStringID id) : base(id) { }
public static void ThrowTypeLoadException(ExceptionStringID id, TypeDesc type) { ThrowTypeLoadException(id, Format.Type(type), Format.OwningModule(type)); }
internal TypeLoadException(ExceptionStringID id, string typeName, string assemblyName, string messageArg) : base(id, new string[] { typeName, assemblyName, messageArg }) { TypeName = typeName; AssemblyName = assemblyName; }
public MissingMethodException(ExceptionStringID id, params string[] args) : base(id, args) { }
public static Exception CreateTypeLoadException(ExceptionStringID id, string typeName, string moduleName, string messageArg) { return new TypeLoadException(SR.Format(GetFormatString(id), typeName, moduleName, messageArg), typeName); }