Skip to content

Commit 66b63c9

Browse files
authored
Only build snippets on latest TFM (#34023)
Also fixes #33975 by reformatting snippets in sdk/core.
1 parent edf48f2 commit 66b63c9

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

eng/Directory.Build.Common.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@
127127
<RequiredTargetFrameworks>net7.0;net6.0</RequiredTargetFrameworks>
128128
<!-- Also test net461 on Windows. -->
129129
<RequiredTargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(RequiredTargetFrameworks);net461</RequiredTargetFrameworks>
130+
<!-- But only build snippets for the latest. -->
131+
<RequiredTargetFrameworks Condition="'$(BuildSnippets)' == 'true'">net7.0</RequiredTargetFrameworks>
130132
</PropertyGroup>
131133

132134
<ItemGroup Condition="'$(IsMgmtSubLibrary)' == 'true' and !$(MSBuildProjectName.Equals('Azure.ResourceManager.Tests'))">

sdk/core/Azure.Core.TestFramework/tests/Azure.Core.TestFramework.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>$(RequiredTargetFrameworks);net6.0</TargetFrameworks>
4+
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -23,5 +23,5 @@
2323
<Compile Include="..\..\..\..\common\ManagementTestShared\Redesign\*.cs" LinkBase="Shared\Mgmt" />
2424
<Compile Include="$(TestFrameworkSupportFiles)" LinkBase="Shared\TestFramework" />
2525
</ItemGroup>
26-
26+
2727
</Project>

sdk/core/Azure.Core/samples/Configuration.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ internal class PollyPolicy : HttpPipelinePolicy
103103
return message.Response;
104104
});
105105
}
106-
// async version omitted for brevity
106+
107+
public override ValueTask ProcessAsync(HttpMessage message, ReadOnlyMemory<HttpPipelinePolicy> pipeline)
108+
{
109+
// async version omitted for brevity
110+
throw new NotImplementedException();
111+
}
107112
}
108113
```
109114

sdk/core/Azure.Core/tests/samples/PollyPolicy.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ public override void Process(HttpMessage message, ReadOnlyMemory<HttpPipelinePol
3939
return message.Response;
4040
});
4141
}
42-
#if SNIPPET
43-
// async version omitted for brevity
44-
}
45-
#endif
46-
#endregion
4742

43+
#if SNIPPET
44+
public override ValueTask ProcessAsync(HttpMessage message, ReadOnlyMemory<HttpPipelinePolicy> pipeline)
45+
{
46+
// async version omitted for brevity
47+
throw new NotImplementedException();
48+
}
49+
#else
4850
public override async ValueTask ProcessAsync(HttpMessage message, ReadOnlyMemory<HttpPipelinePolicy> pipeline)
4951
{
5052
await Policy.Handle<IOException>()
@@ -71,5 +73,7 @@ await Policy.Handle<IOException>()
7173
return message.Response;
7274
});
7375
}
76+
#endif
7477
}
75-
}
78+
#endregion
79+
}

0 commit comments

Comments
 (0)