Skip to content

Commit b89fb14

Browse files
Applesauce314apmoskevitz
andauthored
dotnet-dump returns failure after exhausting retries on ERROR_PARTIAL_COPY (#3830)
* updated to retry on ERROR_PARTIAL_COPY more times and to return a failure on the last loop * Update Dumper.Windows.cs --------- Co-authored-by: apmoskevitz <[email protected]>
1 parent a66abfc commit b89fb14

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Tools/dotnet-dump/Dumper.Windows.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ internal static void CollectDump(int processId, string outputFile, DumpTypeOptio
6767
break;
6868
}
6969

70+
int loopEnd = 10;
7071
// Retry the write dump on ERROR_PARTIAL_COPY
71-
for (int i = 0; i < 5; i++)
72+
for (int i = 0; i <= loopEnd; i++)
7273
{
7374
// Dump the process!
7475
if (NativeMethods.MiniDumpWriteDump(processHandle.DangerousGetHandle(), (uint)processId, stream.SafeFileHandle, dumpType, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero))
@@ -78,10 +79,14 @@ internal static void CollectDump(int processId, string outputFile, DumpTypeOptio
7879
else
7980
{
8081
int err = Marshal.GetHRForLastWin32Error();
81-
if (err != NativeMethods.HR_ERROR_PARTIAL_COPY)
82+
if (err != NativeMethods.HR_ERROR_PARTIAL_COPY || i == loopEnd)
8283
{
8384
Marshal.ThrowExceptionForHR(err);
8485
}
86+
else
87+
{
88+
Console.WriteLine($"retrying due to PARTIAL_COPY #{i}");
89+
}
8590
}
8691
}
8792
}

0 commit comments

Comments
 (0)