Skip to content

Update test projects and samples to target .NET Framework 4.8 #6922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .azure-pipelines/ultimate-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1592,8 +1592,8 @@ stages:
strategy:
# TODO: we could move this generation to the generate_variables stage but it would delay this starting, so just hardcode it for now
matrix:
net462:
framework: net462
net48:
framework: net48
netcoreapp2.1:
framework: netcoreapp2.1
netcoreapp3.0:
Expand Down Expand Up @@ -2175,7 +2175,7 @@ stages:
pool:
name: azure-windows-scale-set-2
variables:
framework: net462
framework: net48

steps:
- template: steps/clone-repo.yml
Expand Down Expand Up @@ -3971,7 +3971,7 @@ stages:
env:
DD_LOGGER_DD_API_KEY: $(ddApiKey)

- script: tracer\build.cmd BuildAndRunDdDotnetArtifactTests --framework net462 --TargetPlatform $(targetPlatform)
- script: tracer\build.cmd BuildAndRunDdDotnetArtifactTests --framework net48 --TargetPlatform $(targetPlatform)
displayName: Build and Test dd-dotnet
env:
DD_LOGGER_DD_API_KEY: $(ddApiKey)
Expand Down
2 changes: 1 addition & 1 deletion docs/development/AutomaticInstrumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ On Windows, we _don't_ typically run multi-api-version tests. There is experimen
# Build and run the integration tests, building only
# your sample, and running only your new tests
# You can choose whichever framework is appropriate
./tracer/build.ps1 BuildAndRunWindowsIntegrationTests -buildConfiguration Debug -framework net462 -Filter MyNewIntegrationTests -SampleName Samples.MyNewSample
./tracer/build.ps1 BuildAndRunWindowsIntegrationTests -buildConfiguration Debug -framework net48 -Filter MyNewIntegrationTests -SampleName Samples.MyNewSample
```

##### On macOs
Expand Down
2 changes: 1 addition & 1 deletion profiler/src/Demos/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<PropertyGroup>
<!-- only run .NET Framework tests on Windows -->
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net462;netcoreapp3.1;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net48;netcoreapp3.1;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp3.1;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
<Platforms>AnyCPU;x64;x86</Platforms>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
<ProjectReference Include="..\Shared\RuntimeMetrics\RuntimeMetrics.csproj" />
<ProjectReference Include="..\Shared\Util\Datadog.Demos.Util.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<Reference Include="System.ServiceProcess" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'net462' ">
<ItemGroup Condition=" '$(TargetFramework)' != 'net48' ">
<PackageReference Include="System.ServiceProcess.ServiceController">
<Version>5.0.0</Version>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<!-- for unit tests -->
<ItemGroup Condition="('$(TargetFramework)' == 'net462')">
<ItemGroup Condition="('$(TargetFramework)' == 'net48')">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void MeasureAllocations(string appName, string framework, string appAssem
}
}

[TestAppFact("Samples.Computer01", new[] { "net462" })]
[TestAppFact("Samples.Computer01", new[] { "net48" })]
public void ShouldGetAllocationSamplesViaEtw(string appName, string framework, string appAssembly)
{
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, commandLine: ScenarioWithoutGC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void ExplicitlyDisableContentionProfiler(string appName, string framework
SamplesHelper.CheckSamplesValueCount(runner.Environment.PprofDir, 1);
}

[TestAppFact("Samples.Computer01", new[] { "net462" })]
[TestAppFact("Samples.Computer01", new[] { "net48" })]
public void ShouldGetLockContentionSamplesViaEtw(string appName, string framework, string appAssembly)
{
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, commandLine: ScenarioWithoutContention);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void ThrowExceptionsInParallel(string appName, string framework, string a
{
StackTrace expectedStack;

if (framework == "net462")
if (framework == "net48")
{
expectedStack = new StackTrace(
new StackFrame("|lm:Samples.ExceptionGenerator |ns:Samples.ExceptionGenerator |ct:ParallelExceptionsScenario |cg: |fn:ThrowExceptions |fg: |sg:(object state)"),
Expand Down Expand Up @@ -120,12 +120,12 @@ public void ThrowExceptionsInParallel(string appName, string framework, string a
}

[Trait("Category", "LinuxOnly")]
[TestAppFact("Samples.ExceptionGenerator", new[] { "net462", "netcoreapp3.1", "net6.0", "net8.0", })] // FIXME: .NET 9 skipping .NET 9 for now
[TestAppFact("Samples.ExceptionGenerator", new[] { "net48", "netcoreapp3.1", "net6.0", "net8.0", })] // FIXME: .NET 9 skipping .NET 9 for now
public void ThrowExceptionsInParallelWithNewCpuProfiler(string appName, string framework, string appAssembly)
{
StackTrace expectedStack;

if (framework == "net462")
if (framework == "net48")
{
expectedStack = new StackTrace(
new StackFrame("|lm:Samples.ExceptionGenerator |ns:Samples.ExceptionGenerator |ct:ParallelExceptionsScenario |cg: |fn:ThrowExceptions |fg: |sg:(object state)"),
Expand Down Expand Up @@ -222,7 +222,7 @@ public void Sampling(string appName, string framework, string appAssembly)
exceptionCounts.Should().ContainKey("System.InvalidOperationException").WhoseValue.Should().Be(1);
}

[TestAppFact("Samples.ExceptionGenerator", new[] { "net462", "netcoreapp3.1", "net6.0", "net8.0", })] // FIXME: .NET 9 skipping .NET 9 for now
[TestAppFact("Samples.ExceptionGenerator", new[] { "net48", "netcoreapp3.1", "net6.0", "net8.0", })] // FIXME: .NET 9 skipping .NET 9 for now
public void GetExceptionSamplesWithTimestamp(string appName, string framework, string appAssembly)
{
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, commandLine: Scenario1);
Expand All @@ -233,7 +233,7 @@ public void GetExceptionSamplesWithTimestamp(string appName, string framework, s
CheckExceptionProfiles(runner, true);
}

[TestAppFact("Samples.ExceptionGenerator", new[] { "net462", "netcoreapp3.1", "net6.0", "net8.0", })] // FIXME: .NET 9 skipping .NET 9 for now
[TestAppFact("Samples.ExceptionGenerator", new[] { "net48", "netcoreapp3.1", "net6.0", "net8.0", })] // FIXME: .NET 9 skipping .NET 9 for now
public void GetExceptionSamplesWithoutTimestamp(string appName, string framework, string appAssembly)
{
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, commandLine: Scenario1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void ShouldGetGarbageCollectionSamplesByDefault(string appName, string fr
Assert.True(CheckSamplesAreGC(runner.Environment.PprofDir));
}

[TestAppFact("Samples.Computer01", new[] { "net462" })]
[TestAppFact("Samples.Computer01", new[] { "net48" })]
public void ShouldGetGarbageCollectionSamplesViaEtw(string appName, string framework, string appAssembly)
{
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, commandLine: ScenarioWithoutGC);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void CheckFeatureIsDisabledIfNetCoreVersionIsLessThan_5(string appName, s
SamplesHelper.GetSamples(runner.Environment.PprofDir).Should().NotContain(sample => IsGcCpuSample(sample));
}

[TestAppFact("Samples.Computer01", new[] { "net462" })]
[TestAppFact("Samples.Computer01", new[] { "net48" })]
public void CheckFeatureIsDisabledIfDotNetFramework(string appName, string framework, string appAssembly)
{
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, commandLine: ScenarioGenerics);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public SignatureTest(ITestOutputHelper output)
_output = output;
}

[TestAppFact("Samples.Computer01", new[] { "net462", "netcoreapp3.1", "net6.0", "net8.0", })] // FIXME: .NET 9 skipping .NET 9 for now
[TestAppFact("Samples.Computer01", new[] { "net48", "netcoreapp3.1", "net6.0", "net8.0", })] // FIXME: .NET 9 skipping .NET 9 for now
public void ValidateSignatures(string appName, string framework, string appAssembly)
{
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, commandLine: "--scenario 20");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public Computer01Test(ITestOutputHelper output)
public void CheckAppDomain(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 1", output: _output);
if (framework == "net462")
if (framework == "net48")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
Expand All @@ -46,7 +46,7 @@ public void CheckAppDomain(string appName, string framework, string appAssembly)
public void CheckGenerics(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 2", output: _output);
if (framework == "net462")
if (framework == "net48")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
Expand All @@ -58,7 +58,7 @@ public void CheckGenerics(string appName, string framework, string appAssembly)
public void CheckPi(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 4", output: _output);
if (framework == "net462")
if (framework == "net48")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
Expand All @@ -70,7 +70,7 @@ public void CheckPi(string appName, string framework, string appAssembly)
public void CheckFibonacci(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 5", output: _output);
if (framework == "net462")
if (framework == "net48")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ExceptionGeneratorTest(ITestOutputHelper output)
public void CheckSmoke(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, _output);
if (framework == "net462")
if (framework == "net48")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
Expand All @@ -39,7 +39,7 @@ public void CheckSmoke(string appName, string framework, string appAssembly)
public void CheckSmokeForOldWayToStackWalk(string appName, string framework, string appAssembly)
{
var runner = new SmokeTestRunner(appName, framework, appAssembly, _output);
if (framework == "net462")
if (framework == "net48")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public EtwEventsTests(ITestOutputHelper output)
_output = output;
}

[TestAppFact("Samples.Computer01", new[] { "net462" })]
[TestAppFact("Samples.Computer01", new[] { "net48" })]
public void CheckErrorWhenNoAgentIsAvailable(string appName, string framework, string appAssembly)
{
var runner = new TestApplicationRunner(appName, framework, appAssembly, _output, commandLine: "--scenario 1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void CheckProfilesSentThroughNamedPipe(string appName, string framework,
"ddog_prof_Exporter_send failed: operation was canceled"
};
var runner = new SmokeTestRunner(appName, framework, appAssembly, commandLine: "--scenario 1", output: _output, transportType: TransportType.NamedPipe);
if (framework == "net462")
if (framework == "net48")
{
runner.EnvironmentHelper.SetVariable(EnvironmentVariables.EtwEnabled, "0");
}
Expand Down
2 changes: 1 addition & 1 deletion profiler/test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<PropertyGroup>
<!-- only run .NET Framework tests on Windows -->
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net462;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">net48;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<!-- Hide warnings for EOL .NET Core targets (e.g. netcoreapp3.0) -->
<CheckEolTargetFramework>false</CheckEolTargetFramework>
Expand Down
Loading
Loading