Skip to content

Commit 8015e00

Browse files
authored
.NET: Surface downstream experimental flags and remove unnecessary suppressions (microsoft#3968)
* Surface downstream experimental flags and remove unecessary suppressions * Fix format error * Fix file encoding. * Address PR comments.
1 parent 54a67d9 commit 8015e00

22 files changed

Lines changed: 93 additions & 14 deletions

File tree

‎dotnet/agent-framework-dotnet.slnx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@
371371
<File Path="src/Shared/Demos/README.md" />
372372
<File Path="src/Shared/Demos/SampleEnvironment.cs" />
373373
</Folder>
374+
<Folder Name="/Solution Items/src/Shared/DiagnosticIds/">
375+
<File Path="src/Shared/DiagnosticIds/DiagnosticsIds.cs" />
376+
<File Path="src/Shared/DiagnosticIds/README.md" />
377+
</Folder>
374378
<Folder Name="/Solution Items/src/Shared/IntegrationTests/">
375379
<File Path="src/Shared/IntegrationTests/AnthropicConfiguration.cs" />
376380
<File Path="src/Shared/IntegrationTests/AzureAIConfiguration.cs" />

‎dotnet/eng/MSBuild/Shared.props‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@
2323
<ItemGroup Condition="'$(InjectSharedStructuredOutput)' == 'true'">
2424
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\Shared\StructuredOutput\*.cs" LinkBase="Shared\StructuredOutput" />
2525
</ItemGroup>
26+
<ItemGroup Condition="'$(InjectSharedDiagnosticIds)' == 'true'">
27+
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\Shared\DiagnosticIds\*.cs" LinkBase="Shared\DiagnosticIds" />
28+
</ItemGroup>
2629
</Project>

‎dotnet/samples/HostedAgents/AgentWithHostedMCP/AgentWithHostedMCP.csproj‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
and cannot access parent folders where Directory.Packages.props resides.
1616
-->
1717
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
18-
<NoWarn>$(NoWarn);MEAI001;OPENAI001</NoWarn>
1918
</PropertyGroup>
2019

2120
<!--

‎dotnet/src/LegacySupport/ExperimentalAttribute/ExperimentalAttribute.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft. All rights reserved.
1+
// Copyright (c) Microsoft. All rights reserved.
22

33
#if !NET8_0_OR_GREATER
44

@@ -28,7 +28,7 @@ internal sealed class ExperimentalAttribute : Attribute
2828
/// <param name="diagnosticId">Human readable explanation for marking experimental API.</param>
2929
public ExperimentalAttribute(string diagnosticId)
3030
{
31-
DiagnosticId = diagnosticId;
31+
this.DiagnosticId = diagnosticId;
3232
}
3333

3434
/// <summary>

‎dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponse.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Diagnostics.CodeAnalysis;
66
using System.Text.Json.Serialization;
77
using Microsoft.Extensions.AI;
8+
using Microsoft.Shared.DiagnosticIds;
89
using Microsoft.Shared.Diagnostics;
910

1011
namespace Microsoft.Agents.AI;
@@ -173,6 +174,7 @@ public IList<ChatMessage> Messages
173174
/// to poll for completion.
174175
/// </para>
175176
/// </remarks>
177+
[Experimental(DiagnosticIds.Experiments.AIResponseContinuations)]
176178
public ResponseContinuationToken? ContinuationToken { get; set; }
177179

178180
/// <summary>

‎dotnet/src/Microsoft.Agents.AI.Abstractions/AgentRunOptions.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

33
using System;
4+
using System.Diagnostics.CodeAnalysis;
45
using Microsoft.Extensions.AI;
6+
using Microsoft.Shared.DiagnosticIds;
57
using Microsoft.Shared.Diagnostics;
68

79
namespace Microsoft.Agents.AI;
@@ -50,6 +52,7 @@ protected AgentRunOptions(AgentRunOptions options)
5052
/// can be polled for completion by obtaining the token from the <see cref="AgentResponse.ContinuationToken"/> property
5153
/// and passing it via this property on subsequent calls to <see cref="AIAgent.RunAsync(AgentSession?, AgentRunOptions?, System.Threading.CancellationToken)"/>.
5254
/// </remarks>
55+
[Experimental(DiagnosticIds.Experiments.AIResponseContinuations)]
5356
public ResponseContinuationToken? ContinuationToken { get; set; }
5457

5558
/// <summary>

‎dotnet/src/Microsoft.Agents.AI.Abstractions/Microsoft.Agents.AI.Abstractions.csproj‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<InjectIsExternalInitOnLegacy>true</InjectIsExternalInitOnLegacy>
1515
<InjectRequiredMemberOnLegacy>true</InjectRequiredMemberOnLegacy>
1616
<InjectCompilerFeatureRequiredOnLegacy>true</InjectCompilerFeatureRequiredOnLegacy>
17+
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
18+
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
1719
</PropertyGroup>
1820

1921
<Import Project="$(RepoRoot)/dotnet/nuget/nuget-package.props" />

‎dotnet/src/Microsoft.Agents.AI.AzureAI/AzureAIProjectChatClient.cs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3+
using System.Diagnostics.CodeAnalysis;
34
using System.Runtime.CompilerServices;
45
using Azure.AI.Projects;
56
using Azure.AI.Projects.OpenAI;
67
using Microsoft.Extensions.AI;
8+
using Microsoft.Shared.DiagnosticIds;
79
using Microsoft.Shared.Diagnostics;
810
using OpenAI.Responses;
911

10-
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
11-
1212
namespace Microsoft.Agents.AI.AzureAI;
1313

1414
/// <summary>
1515
/// Provides a chat client implementation that integrates with Azure AI Agents, enabling chat interactions using
1616
/// Azure-specific agent capabilities.
1717
/// </summary>
18+
[Experimental(DiagnosticIds.Experiments.AIOpenAIResponses)]
1819
internal sealed class AzureAIProjectChatClient : DelegatingChatClient
1920
{
2021
private readonly ChatClientMetadata? _metadata;

‎dotnet/src/Microsoft.Agents.AI.AzureAI/AzureAIProjectChatClientExtensions.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
using System.ClientModel;
44
using System.ClientModel.Primitives;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Runtime.CompilerServices;
67
using System.Text;
78
using System.Text.Json;
@@ -12,18 +13,17 @@
1213
using Microsoft.Agents.AI;
1314
using Microsoft.Agents.AI.AzureAI;
1415
using Microsoft.Extensions.AI;
16+
using Microsoft.Shared.DiagnosticIds;
1517
using Microsoft.Shared.Diagnostics;
1618
using OpenAI;
1719
using OpenAI.Responses;
1820

19-
#pragma warning disable MEAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
20-
#pragma warning disable OPENAI001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
21-
2221
namespace Azure.AI.Projects;
2322

2423
/// <summary>
2524
/// Provides extension methods for <see cref="AIProjectClient"/>.
2625
/// </summary>
26+
[Experimental(DiagnosticIds.Experiments.AIOpenAIResponses)]
2727
public static partial class AzureAIProjectChatClientExtensions
2828
{
2929
/// <summary>

‎dotnet/src/Microsoft.Agents.AI.AzureAI/Microsoft.Agents.AI.AzureAI.csproj‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
<Import Project="$(RepoRoot)/dotnet/nuget/nuget-package.props" />
1010

11+
<PropertyGroup>
12+
<InjectExperimentalAttributeOnLegacy>true</InjectExperimentalAttributeOnLegacy>
13+
<InjectSharedDiagnosticIds>true</InjectSharedDiagnosticIds>
14+
</PropertyGroup>
15+
1116
<ItemGroup>
1217
<PackageReference Include="Azure.AI.Projects" />
1318
<PackageReference Include="Azure.AI.Projects.OpenAI" />

0 commit comments

Comments
 (0)