From: Andrew Au Date: Fri, 27 Jan 2023 20:10:51 +0000 (-0800) Subject: Make sure we specify arguments only when the test ask for it (#80947) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~4380 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce9c269e4d8deba2d4328fa2a5251adce74f5eab;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Make sure we specify arguments only when the test ask for it (#80947) --- diff --git a/src/tests/GC/Stress/Framework/ReliabilityFramework.cs b/src/tests/GC/Stress/Framework/ReliabilityFramework.cs index 1b6e214..3eb6d36 100644 --- a/src/tests/GC/Stress/Framework/ReliabilityFramework.cs +++ b/src/tests/GC/Stress/Framework/ReliabilityFramework.cs @@ -992,7 +992,12 @@ public class ReliabilityFramework 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) { diff --git a/src/tests/GC/Stress/Framework/ReliabilityTest.cs b/src/tests/GC/Stress/Framework/ReliabilityTest.cs index 4ef123c..0efc1ec 100644 --- a/src/tests/GC/Stress/Framework/ReliabilityTest.cs +++ b/src/tests/GC/Stress/Framework/ReliabilityTest.cs @@ -48,7 +48,11 @@ public class TestAssemblyLoadContext : AssemblyLoadContext 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); }