Пример #1
0
 // 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();
     }
 }
Пример #2
0
 public InvalidProgramException(ExceptionStringID id, MethodDesc method)
     : base(id, Format.Method(method))
 {
 }
Пример #3
0
 public MissingFieldException(ExceptionStringID id, params string[] args)
     : base(id, args)
 {
 }
Пример #4
0
 protected internal MissingMemberException(ExceptionStringID id, params string[] args)
     : base(id, args)
 {
 }
Пример #5
0
 private TypeLoadException(ExceptionStringID id, string typeName, string assemblyName)
     : base(id, new string[] { typeName, assemblyName })
 {
     TypeName     = typeName;
     AssemblyName = assemblyName;
 }
Пример #6
0
 public FileNotFoundException(ExceptionStringID id, string fileName)
     : base(id, fileName)
 {
 }
Пример #7
0
 public static Exception CreateFileNotFoundException(ExceptionStringID id, string fileName)
 {
     throw new System.IO.FileNotFoundException(SR.Format(GetFormatString(id), fileName), fileName);
 }
Пример #8
0
 public static Exception CreateBadImageFormatException(ExceptionStringID id)
 {
     return(new BadImageFormatException(GetFormatString(id)));
 }
Пример #9
0
 public static void ThrowTypeLoadExceptionWithArgument(ExceptionStringID id, string className, string typeName, string messageArg)
 {
     throw TypeLoaderExceptionHelper.CreateTypeLoadException(id, className, typeName, messageArg);
 }
Пример #10
0
 public static void ThrowTypeLoadException(ExceptionStringID id, string className, string typeName)
 {
     throw TypeLoaderExceptionHelper.CreateTypeLoadException(id, className, typeName);
 }
Пример #11
0
 public static Exception CreateInvalidProgramException(ExceptionStringID id, string methodName)
 {
     throw new InvalidProgramException(SR.Format(GetFormatString(id), methodName));
 }
Пример #12
0
 public static Exception CreateFileNotFoundException(ExceptionStringID id, string fileName)
 {
     throw new System.IO.FileNotFoundException(SR.Format(GetFormatString(id), fileName), fileName);
 }
Пример #13
0
 public static Exception CreateMissingMethodException(ExceptionStringID id, string methodName)
 {
     throw new MissingMethodException(SR.Format(GetFormatString(id), methodName));
 }
Пример #14
0
 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);
 }
Пример #15
0
 public static void ThrowMissingMethodException(ExceptionStringID id, string methodName)
 {
     throw TypeLoaderExceptionHelper.CreateMissingMethodException(id, methodName);
 }
Пример #16
0
 public TypeLoadException(ExceptionStringID id, MethodDesc method)
     : this(id, Format.Type(method.OwningType), Format.Module(GetOwningModule(method)), Format.Method(method))
 {
 }
Пример #17
0
 public static void ThrowMissingFieldException(ExceptionStringID id, string fieldName)
 {
     throw TypeLoaderExceptionHelper.CreateMissingFieldException(id, fieldName);
 }
Пример #18
0
 public static Exception CreateMissingFieldException(ExceptionStringID id, string fieldName)
 {
     return(new MissingFieldException(SR.Format(GetFormatString(id), fieldName)));
 }
Пример #19
0
 public static void ThrowFileNotFoundException(ExceptionStringID id, string fileName)
 {
     throw TypeLoaderExceptionHelper.CreateFileNotFoundException(id, fileName);
 }
Пример #20
0
 public TypeLoadException(ExceptionStringID id, TypeDesc type, string messageArg)
     : this(id, Format.Type(type), Format.OwningModule(type), messageArg)
 {
 }
Пример #21
0
 public static void ThrowInvalidProgramException(ExceptionStringID id, string methodName)
 {
     throw TypeLoaderExceptionHelper.CreateInvalidProgramException(id, methodName);
 }
Пример #22
0
 public TypeSystemException(ExceptionStringID id, params string[] args)
 {
     StringID   = id;
     _arguments = args;
 }
Пример #23
0
 private TypeLoadException(ExceptionStringID id, string typeName, string assemblyName)
     : base(id, new string[] { typeName, assemblyName })
 {
     TypeName = typeName;
     AssemblyName = assemblyName;
 }
Пример #24
0
 public static void ThrowTypeLoadException(ExceptionStringID id, MethodDesc method)
 {
     ThrowTypeLoadException(id, Format.Type(method.OwningType), Format.OwningModule(method), Format.Method(method));
 }
Пример #25
0
 public TypeLoadException(ExceptionStringID id, TypeDesc type, string messageArg)
     : this(id, Format.Type(type), Format.OwningModule(type), messageArg)
 {
 }
Пример #26
0
 public static Exception CreateMissingFieldException(ExceptionStringID id, string fieldName)
 {
     return new MissingFieldException(SR.Format(GetFormatString(id), fieldName));
 }
Пример #27
0
 public TypeLoadException(ExceptionStringID id, TypeDesc type)
     : this(id, Format.Type(type), Format.OwningModule(type))
 {
 }
Пример #28
0
 public FileNotFoundException(ExceptionStringID id, string fileName)
     : base(id, fileName)
 {
 }
Пример #29
0
 public static void ThrowTypeLoadException(ExceptionStringID id, string className, string typeName)
 {
     throw TypeLoaderExceptionHelper.CreateTypeLoadException(id, className, typeName);
 }
Пример #30
0
 public TypeSystemException(ExceptionStringID id, params string[] args)
 {
     StringID = id;
     _arguments = args;
 }
Пример #31
0
 public static void ThrowTypeLoadExceptionWithArgument(ExceptionStringID id, string className, string typeName, string messageArg)
 {
     throw TypeLoaderExceptionHelper.CreateTypeLoadException(id, className, typeName, messageArg);
 }
Пример #32
0
 public TypeLoadException(ExceptionStringID id, string typeName, string assemblyName, string messageArg = null)
     : base(id, new string[] { typeName, assemblyName, messageArg })
 {
     TypeName = typeName;
     AssemblyName = assemblyName;
 }
Пример #33
0
 public static void ThrowMissingMethodException(ExceptionStringID id, string methodName)
 {
     throw TypeLoaderExceptionHelper.CreateMissingMethodException(id, methodName);
 }
Пример #34
0
 protected internal MissingMemberException(ExceptionStringID id, params string[] args)
     : base(id, args)
 {
 }
Пример #35
0
 public static void ThrowMissingFieldException(ExceptionStringID id, string fieldName)
 {
     throw TypeLoaderExceptionHelper.CreateMissingFieldException(id, fieldName);
 }
Пример #36
0
 public static Exception CreateTypeLoadException(ExceptionStringID id, string typeName, string moduleName, string messageArg)
 {
     return(new TypeLoadException(SR.Format(GetFormatString(id), typeName, moduleName, messageArg), typeName));
 }
Пример #37
0
 public static string GetFormatString(ExceptionStringID id)
 {
     return(s_stringResourceManager.Value.GetString(id.ToString(), CultureInfo.InvariantCulture));
 }
Пример #38
0
 public static Exception CreateMissingMethodException(ExceptionStringID id, string methodName)
 {
     throw new MissingMethodException(SR.Format(GetFormatString(id), methodName));
 }
Пример #39
0
 public static Exception CreateInvalidProgramException(ExceptionStringID id)
 {
     throw new InvalidProgramException(GetFormatString(id));
 }
Пример #40
0
 public static Exception CreateInvalidProgramException(ExceptionStringID id, string methodName)
 {
     throw new InvalidProgramException(SR.Format(GetFormatString(id), methodName));
 }
Пример #41
0
 public static Exception CreateMarshalDirectiveException(ExceptionStringID id)
 {
     throw new MarshalDirectiveException(GetFormatString(id));
 }
Пример #42
0
 public TypeLoadException(ExceptionStringID id, TypeDesc type)
     : this(id, Format.Type(type), Format.OwningModule(type))
 {
 }
Пример #43
0
 internal MissingFieldException(ExceptionStringID id, params string[] args)
     : base(id, args)
 {
 }
Пример #44
0
 public InvalidProgramException(ExceptionStringID id, MethodDesc method)
     : base(id, Format.Method(method))
 {
 }
Пример #45
0
 internal FileNotFoundException(ExceptionStringID id, string fileName)
     : base(id, fileName)
 {
 }
Пример #46
0
 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));
 }
Пример #47
0
 internal InvalidProgramException(ExceptionStringID id, string method)
     : base(id, method)
 {
 }
Пример #48
0
 public TypeLoadException(ExceptionStringID id, MethodDesc method)
     : this(id, Format.Type(method.OwningType), Format.OwningModule(method), Format.Method(method))
 {
 }
Пример #49
0
 internal InvalidProgramException(ExceptionStringID id)
     : base(id)
 {
 }
Пример #50
0
 public static void ThrowTypeLoadException(ExceptionStringID id, TypeDesc type)
 {
     ThrowTypeLoadException(id, Format.Type(type), Format.OwningModule(type));
 }
Пример #51
0
 internal TypeLoadException(ExceptionStringID id, string typeName, string assemblyName, string messageArg)
     : base(id, new string[] { typeName, assemblyName, messageArg })
 {
     TypeName     = typeName;
     AssemblyName = assemblyName;
 }
Пример #52
0
 public MissingMethodException(ExceptionStringID id, params string[] args)
     : base(id, args)
 {
 }
Пример #53
0
 public static Exception CreateTypeLoadException(ExceptionStringID id, string typeName, string moduleName, string messageArg)
 {
     return new TypeLoadException(SR.Format(GetFormatString(id), typeName, moduleName, messageArg), typeName);
 }