Skip to content

Commit f442e6a

Browse files
authored
Merge pull request #14 from wlmiller/master
Fix errors when using multiple referenced libraries.
2 parents 82096ee + 75a567a commit f442e6a

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/coverlet.core/CoverageTracker.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,37 @@ namespace Coverlet.Core
77
{
88
public static class CoverageTracker
99
{
10-
private static List<string> _markers;
11-
private static string _path;
10+
private static Dictionary<string, List<string>> _markers;
1211
private static bool _registered;
1312

1413
[ExcludeFromCoverage]
1514
public static void MarkExecuted(string path, string marker)
1615
{
1716
if (_markers == null)
18-
_markers = new List<string>();
17+
{
18+
_markers = new Dictionary<string, List<string>>();
19+
}
20+
21+
if (!_markers.ContainsKey(path))
22+
{
23+
_markers.Add(path, new List<string>());
24+
}
1925

2026
if (!_registered)
2127
{
2228
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
2329
_registered = true;
2430
}
2531

26-
_markers.Add(marker);
27-
_path = path;
32+
_markers[path].Add(marker);
2833
}
2934

3035
public static void CurrentDomain_ProcessExit(object sender, EventArgs e)
31-
=> File.WriteAllLines(_path, _markers);
36+
{
37+
foreach (var kvp in _markers)
38+
{
39+
File.WriteAllLines(kvp.Key, kvp.Value);
40+
}
41+
}
3242
}
3343
}

0 commit comments

Comments
 (0)