private Type GetExceptionType(RpcErrorTypeBehavior typeResolution) { Type tException = typeof(ApplicationException); Assembly found = tException.Assembly; if (typeResolution == RpcErrorTypeBehavior.NoTypeResolution) { return(tException); } if (!HasFullTypeName || !HasAssemblyName || String.IsNullOrEmpty(FullTypeName) || String.IsNullOrEmpty(AssemblyName)) { return(tException); } if (!ValidTypeName.IsMatch(FullTypeName)) { return(tException); } if (typeResolution == RpcErrorTypeBehavior.OnlyUseMsCorLibTypes) { return(found.GetType(FullTypeName) ?? tException); } AssemblyName name = new AssemblyName(AssemblyName); if (name.CodeBase != null) { return(tException); } if (null != (found = LoadedAssemblies.Lookup(name))) { return(found.GetType(FullTypeName) ?? tException); } if (typeResolution == RpcErrorTypeBehavior.OnlyUseLoadedAssemblies) { return(tException); } if (typeResolution == RpcErrorTypeBehavior.OnlyLoadStrongNamed && name.GetPublicKeyToken() == null) { return(tException); } Type test = Type.GetType(String.Format("{0}, {1}", FullTypeName, name)); if (test != null) { return(test); } if (typeResolution == RpcErrorTypeBehavior.LoadAnyAssembly) { return(Type.GetType(String.Format("{0}, {1}", FullTypeName, new AssemblyName(name.Name))) ?? tException); } return(tException); }