Skip to content

Commit ee8e4e0

Browse files
KirkMunroiSazonov
authored andcommitted
Remove WorkflowJobSourceAdapter reference (PowerShell#10326)
1 parent 6bf5c76 commit ee8e4e0

File tree

1 file changed

+34
-42
lines changed
  • src/System.Management.Automation/engine/remoting/client

1 file changed

+34
-42
lines changed

src/System.Management.Automation/engine/remoting/client/JobManager.cs

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -81,51 +81,43 @@ internal void RegisterJobSourceAdapter(Type jobSourceAdapterType)
8181
Dbg.Assert(jobSourceAdapterType != null, "JobSourceAdapterType should never be called with null value.");
8282
object instance = null;
8383

84-
if (jobSourceAdapterType.FullName != null && jobSourceAdapterType.FullName.EndsWith("WorkflowJobSourceAdapter", StringComparison.OrdinalIgnoreCase))
84+
ConstructorInfo constructor = jobSourceAdapterType.GetConstructor(Type.EmptyTypes);
85+
if (!constructor.IsPublic)
8586
{
86-
MethodInfo method = jobSourceAdapterType.GetMethod("GetInstance");
87-
instance = method.Invoke(null, null);
87+
string message = string.Format(CultureInfo.CurrentCulture,
88+
RemotingErrorIdStrings.JobManagerRegistrationConstructorError,
89+
jobSourceAdapterType.FullName);
90+
throw new InvalidOperationException(message);
8891
}
89-
else
90-
{
91-
ConstructorInfo constructor = jobSourceAdapterType.GetConstructor(Type.EmptyTypes);
92-
if (!constructor.IsPublic)
93-
{
94-
string message = string.Format(CultureInfo.CurrentCulture,
95-
RemotingErrorIdStrings.JobManagerRegistrationConstructorError,
96-
jobSourceAdapterType.FullName);
97-
throw new InvalidOperationException(message);
98-
}
9992

100-
try
101-
{
102-
instance = constructor.Invoke(null);
103-
}
104-
catch (MemberAccessException exception)
105-
{
106-
_tracer.TraceException(exception);
107-
throw;
108-
}
109-
catch (TargetInvocationException exception)
110-
{
111-
_tracer.TraceException(exception);
112-
throw;
113-
}
114-
catch (TargetParameterCountException exception)
115-
{
116-
_tracer.TraceException(exception);
117-
throw;
118-
}
119-
catch (NotSupportedException exception)
120-
{
121-
_tracer.TraceException(exception);
122-
throw;
123-
}
124-
catch (SecurityException exception)
125-
{
126-
_tracer.TraceException(exception);
127-
throw;
128-
}
93+
try
94+
{
95+
instance = constructor.Invoke(null);
96+
}
97+
catch (MemberAccessException exception)
98+
{
99+
_tracer.TraceException(exception);
100+
throw;
101+
}
102+
catch (TargetInvocationException exception)
103+
{
104+
_tracer.TraceException(exception);
105+
throw;
106+
}
107+
catch (TargetParameterCountException exception)
108+
{
109+
_tracer.TraceException(exception);
110+
throw;
111+
}
112+
catch (NotSupportedException exception)
113+
{
114+
_tracer.TraceException(exception);
115+
throw;
116+
}
117+
catch (SecurityException exception)
118+
{
119+
_tracer.TraceException(exception);
120+
throw;
129121
}
130122

131123
if (instance != null)

0 commit comments

Comments
 (0)