Remove WorkflowJobSourceAdapter reference (#10326)

This commit is contained in:
Kirk Munro
2019-09-17 10:46:35 +05:00
committed by Ilya
parent 6bf5c7656b
commit ee8e4e00e0
@@ -81,51 +81,43 @@ namespace System.Management.Automation
Dbg.Assert(jobSourceAdapterType != null, "JobSourceAdapterType should never be called with null value.");
object instance = null;
if (jobSourceAdapterType.FullName != null && jobSourceAdapterType.FullName.EndsWith("WorkflowJobSourceAdapter", StringComparison.OrdinalIgnoreCase))
ConstructorInfo constructor = jobSourceAdapterType.GetConstructor(Type.EmptyTypes);
if (!constructor.IsPublic)
{
MethodInfo method = jobSourceAdapterType.GetMethod("GetInstance");
instance = method.Invoke(null, null);
string message = string.Format(CultureInfo.CurrentCulture,
RemotingErrorIdStrings.JobManagerRegistrationConstructorError,
jobSourceAdapterType.FullName);
throw new InvalidOperationException(message);
}
else
{
ConstructorInfo constructor = jobSourceAdapterType.GetConstructor(Type.EmptyTypes);
if (!constructor.IsPublic)
{
string message = string.Format(CultureInfo.CurrentCulture,
RemotingErrorIdStrings.JobManagerRegistrationConstructorError,
jobSourceAdapterType.FullName);
throw new InvalidOperationException(message);
}
try
{
instance = constructor.Invoke(null);
}
catch (MemberAccessException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (TargetInvocationException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (TargetParameterCountException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (NotSupportedException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (SecurityException exception)
{
_tracer.TraceException(exception);
throw;
}
try
{
instance = constructor.Invoke(null);
}
catch (MemberAccessException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (TargetInvocationException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (TargetParameterCountException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (NotSupportedException exception)
{
_tracer.TraceException(exception);
throw;
}
catch (SecurityException exception)
{
_tracer.TraceException(exception);
throw;
}
if (instance != null)