@@ -82,7 +82,7 @@ public async Task DoesNotInstrumentDotnetBuild()
82
82
83
83
using var agent = EnvironmentHelper . GetMockAgent ( useTelemetry : true ) ;
84
84
85
- var logDir = await RunDotnet ( "new console -n instrumentation_test -o . --no-restore -f net8.0 " ) ;
85
+ var logDir = await RunDotnet ( "new console -n instrumentation_test -o . --no-restore" ) ;
86
86
AssertNotInstrumented ( agent , logDir ) ;
87
87
88
88
logDir = await RunDotnet ( "restore" ) ;
@@ -110,11 +110,14 @@ public async Task DoesNotInstrumentExcludedNames(string excludedProcess)
110
110
var workingDir = Path . Combine ( Path . GetTempPath ( ) , Path . GetFileNameWithoutExtension ( Path . GetRandomFileName ( ) ) ) ;
111
111
Directory . CreateDirectory ( workingDir ) ;
112
112
113
+ // Hack to ensure that the .NET 8.0 SDK is used instead of .NET 10 as it complains about not finding the runtime
114
+ EnsureNet8Sdk ( workingDir ) ;
115
+
113
116
Output . WriteLine ( "Using workingDirectory: " + workingDir ) ;
114
117
115
118
using var agent = EnvironmentHelper . GetMockAgent ( useTelemetry : true ) ;
116
119
117
- var logDir = await RunDotnet ( $ "new console -n { excludedProcess } -o . --no-restore -f net8.0 ") ;
120
+ var logDir = await RunDotnet ( $ "new console -n { excludedProcess } -o . --no-restore") ;
118
121
AssertNotInstrumented ( agent , logDir ) ;
119
122
120
123
var programCs = GetProgramCSThatMakesSpans ( ) ;
@@ -148,11 +151,14 @@ public async Task DoesInstrumentAllowedProcesses(string allowedProcess)
148
151
var workingDir = Path . Combine ( Path . GetTempPath ( ) , Path . GetFileNameWithoutExtension ( Path . GetRandomFileName ( ) ) ) ;
149
152
Directory . CreateDirectory ( workingDir ) ;
150
153
154
+ // Hack to ensure that the .NET 8.0 SDK is used instead of .NET 10 as it complains about not finding the runtime
155
+ EnsureNet8Sdk ( workingDir ) ;
156
+
151
157
Output . WriteLine ( "Using workingDirectory: " + workingDir ) ;
152
158
153
159
using var agent = EnvironmentHelper . GetMockAgent ( useTelemetry : true ) ;
154
160
155
- var logDir = await RunDotnet ( $ "new console -n { allowedProcess } -o . --no-restore -f net8.0 ") ;
161
+ var logDir = await RunDotnet ( $ "new console -n { allowedProcess } -o . --no-restore") ;
156
162
AssertNotInstrumented ( agent , logDir ) ;
157
163
var programCs = GetProgramCSThatMakesSpans ( ) ;
158
164
@@ -182,11 +188,14 @@ public async Task InstrumentsDotNetTest()
182
188
var workingDir = Path . Combine ( Path . GetTempPath ( ) , Path . GetFileNameWithoutExtension ( Path . GetRandomFileName ( ) ) ) ;
183
189
Directory . CreateDirectory ( workingDir ) ;
184
190
191
+ // Hack to ensure that the .NET 8.0 SDK is used instead of .NET 10 as it complains about not finding the runtime
192
+ EnsureNet8Sdk ( workingDir ) ;
193
+
185
194
Output . WriteLine ( "Using workingDirectory: " + workingDir ) ;
186
195
187
196
using var agent = EnvironmentHelper . GetMockAgent ( useTelemetry : true ) ;
188
197
189
- var logDir = await RunDotnet ( "new xunit -n instrumentation_test -o . --no-restore -f net8.0 " ) ;
198
+ var logDir = await RunDotnet ( "new xunit -n instrumentation_test -o . --no-restore" ) ;
190
199
AssertNotInstrumented ( agent , logDir ) ;
191
200
192
201
// this _should_ be instrumented so we expect managed data.
@@ -840,6 +849,17 @@ private void AddFilesAsReportable(string logDir, AssertionScope scope, string[]
840
849
} ) ;
841
850
}
842
851
852
+ private void EnsureNet8Sdk ( string workingDirectory )
853
+ {
854
+ var globalJson = @"{
855
+ ""sdk"": {
856
+ ""version"": ""8.0.0"",
857
+ ""rollForward"": ""latestMinor""
858
+ }
859
+ }" ;
860
+ File . WriteAllText ( Path . Combine ( workingDirectory , "global.json" ) , globalJson ) ;
861
+ }
862
+
843
863
private bool IsAllLoggingDisabledForBailout ( )
844
864
{
845
865
var isSsi = EnvironmentHelper . CustomEnvironmentVariables . TryGetValue ( "DD_INJECTION_ENABLED" , out var injectionEnabled )
0 commit comments