Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 0b34bdc

Browse files
committed
Merge pull request #2417 from Priya91/processbug
BugFix: Refresh the process component to ensure Modules is updated.
2 parents fee1721 + 6733f17 commit 0b34bdc

File tree

1 file changed

+7
-1
lines changed
  • src/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests

1 file changed

+7
-1
lines changed

src/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests/ProcessTests.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,13 @@ public void TestMainModule()
200200
}
201201

202202
// Ensure the process has loaded the modules.
203-
Assert.True(SpinWait.SpinUntil(() => _process.Modules.Count > 0, WaitInMS));
203+
Assert.True(SpinWait.SpinUntil(() =>
204+
{
205+
if (_process.Modules.Count > 0)
206+
return true;
207+
_process.Refresh();
208+
return false;
209+
}, WaitInMS));
204210

205211
// Get MainModule property from a Process object
206212
ProcessModule mainModule = _process.MainModule;

0 commit comments

Comments
 (0)