internal static Type LoadType(String typeName, String assemblyName)
{
Assembly asm = null;
// All the LoadType callers have been protected by
// Infrastructure LinkDemand, it is safe to assert
// this permission.
// Assembly.Load demands FileIO when the target
// assembly is the same as the executable running.
new FileIOPermission(PermissionState.Unrestricted).Assert();
try {
asm = Assembly.Load(assemblyName);
}
finally {
CodeAccessPermission.RevertAssert();
}
if (asm == null)
{
throw new RemotingException(
String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_AssemblyLoadFailed"),
assemblyName));
}
Type type = asm.GetType(typeName, false, false);
if (type == null)
{
throw new RemotingException(
String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadType"),
typeName + ", " + assemblyName));
}
return type;
} // LoadType