File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
src/coverlet.collector/InProcDataCollection Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -239,8 +239,9 @@ Process Id: 29228 Name: dotnet
239
239
240
240
## Enable collector instrumentation debugging
241
241
242
- You can live attach and debug collectors with ` COVERLET_DATACOLLECTOR_OUTOFPROC_DEBUG ` env variable
242
+ You can live attach and debug collectors with ` COVERLET_DATACOLLECTOR_OUTOFPROC_DEBUG ` and ` COVERLET_DATACOLLECTOR_INPROC_DEBUG ` env variable
243
243
```
244
244
set COVERLET_DATACOLLECTOR_OUTOFPROC_DEBUG=1
245
+ set COVERLET_DATACOLLECTOR_INPROC_DEBUG=1
245
246
```
246
247
You will be asket to attach a debugger through UI popup.
Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Diagnostics ;
2
3
using System . Reflection ;
3
4
4
5
using coverlet . collector . Resources ;
@@ -14,8 +15,20 @@ public class CoverletInProcDataCollector : InProcDataCollection
14
15
{
15
16
private TestPlatformEqtTrace _eqtTrace ;
16
17
18
+ private void AttachDebugger ( )
19
+ {
20
+ if ( int . TryParse ( Environment . GetEnvironmentVariable ( "COVERLET_DATACOLLECTOR_INPROC_DEBUG" ) , out int result ) && result == 1 )
21
+ {
22
+ Debugger . Launch ( ) ;
23
+ Debugger . Break ( ) ;
24
+ }
25
+ }
26
+
17
27
public void Initialize ( IDataCollectionSink dataCollectionSink )
18
28
{
29
+
30
+ AttachDebugger ( ) ;
31
+
19
32
_eqtTrace = new TestPlatformEqtTrace ( ) ;
20
33
_eqtTrace . Verbose ( "Initialize CoverletInProcDataCollector" ) ;
21
34
}
You can’t perform that action at this time.
0 commit comments