Skip to content

Commit

Permalink
Make sure we specify arguments only when the test ask for it (dotnet#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cshung authored Jan 27, 2023
1 parent bf1f19f commit ce9c269
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/tests/GC/Stress/Framework/ReliabilityFramework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,12 @@ private void StartTestWorker(object test)

try
{
daTest.EntryPointMethod.Invoke(null, new object[] { (daTest.Arguments == null) ? new string[0] : daTest.GetSplitArguments() });
object[] parameters = null;
if (daTest.EntryPointMethod.GetParameters().Length == 1)
{
parameters = new object[] { (daTest.Arguments == null) ? new string[0] : daTest.GetSplitArguments() };
}
daTest.EntryPointMethod.Invoke(null, parameters);
}
catch (Exception e)
{
Expand Down
6 changes: 5 additions & 1 deletion src/tests/GC/Stress/Framework/ReliabilityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ public int ExecuteAssemblyByName(string name, string[] args)
public int ExecuteAssembly(string path, string[] args)
{
Assembly assembly = LoadFromAssemblyPath(Path.Combine(_applicationBase, path));
object[] actualArgs = new object[] { args != null ? args : new string[0] };
object[] actualArgs = null;
if (assembly.EntryPoint.GetParameters().Length == 1)
{
actualArgs = new object[] { args != null ? args : new string[0] };
}
return (int)assembly.EntryPoint.Invoke(null, actualArgs);
}

Expand Down

0 comments on commit ce9c269

Please sign in to comment.