-
Notifications
You must be signed in to change notification settings - Fork 315
/
NetClientCrashDumper.cs
44 lines (35 loc) · 1.38 KB
/
NetClientCrashDumper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces;
namespace Microsoft.TestPlatform.Extensions.BlameDataCollector;
internal class NetClientCrashDumper : ICrashDumper
{
private string? _outputDirectory;
private readonly IFileHelper _fileHelper;
public NetClientCrashDumper(IFileHelper fileHelper)
{
_fileHelper = fileHelper;
}
public void AttachToTargetProcess(int processId, string outputDirectory, DumpTypeOption dumpType, bool collectAlways, Action<string> logWarning)
{
// we don't need to do anything directly here, we setup the env variables
// in the dumper configuration, including the path
_outputDirectory = outputDirectory;
}
public void DetachFromTargetProcess(int processId)
{
// here we might consider renaming the files to have timestamp
}
public IEnumerable<string> GetDumpFiles(bool _)
{
return _fileHelper.DirectoryExists(_outputDirectory)
? _fileHelper.GetFiles(_outputDirectory, "*_crashdump*.dmp", SearchOption.AllDirectories)
: Array.Empty<string>();
}
public void WaitForDumpToFinish()
{
}
}