File tree Expand file tree Collapse file tree
src/xunit.v3.runner.common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ public sealed class CecilSourceInformationProvider : ISourceInformationProvider
3939 /// <param name="assemblyFileName">The test assembly filename</param>
4040 public static ISourceInformationProvider Create ( string ? assemblyFileName )
4141 {
42+ if ( ! RunSettingsUtility . CollectSourceInformation )
43+ return NullSourceInformationProvider . Instance ;
44+
4245 var folder = Path . GetDirectoryName ( assemblyFileName ) ;
4346 if ( folder is null )
4447 return NullSourceInformationProvider . Instance ;
Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections ;
3+ using System . Linq ;
4+ using System . Xml . Linq ;
5+ using System . Xml . XPath ;
6+
7+ namespace Xunit . Runner . Common ;
8+
9+ internal static class RunSettingsUtility
10+ {
11+ static bool ? collectSourceInformation ;
12+
13+ public static bool CollectSourceInformation
14+ {
15+ get
16+ {
17+ if ( ! collectSourceInformation . HasValue )
18+ {
19+ try
20+ {
21+ var runSettings = Environment . GetEnvironmentVariable ( "TESTINGPLATFORM_EXPERIMENTAL_VSTEST_RUNSETTINGS" ) ;
22+ if ( runSettings is not null )
23+ {
24+ var doc = XDocument . Parse ( runSettings ) ;
25+ if ( doc . Root ? . XPathEvaluate ( "/RunSettings/RunConfiguration/CollectSourceInformation" ) is IEnumerable enumerable )
26+ if ( enumerable . OfType < XElement > ( ) . FirstOrDefault ( ) is XElement element )
27+ collectSourceInformation = bool . Parse ( element . Value ) ;
28+ }
29+ }
30+ catch { }
31+
32+ collectSourceInformation ??= true ;
33+ }
34+
35+ return collectSourceInformation . Value ;
36+ }
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments