From c1ea834e1fd05038f93ea126417d0776460610b5 Mon Sep 17 00:00:00 2001 From: alliscode Date: Wed, 15 Apr 2026 17:14:01 -0700 Subject: [PATCH] Fix IDE0009: add 'this' qualification in all HostedAgentsV2 samples Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../HostedAgentsV2/Hosted-FoundryAgent/Program.cs | 10 +++++----- .../HostedAgentsV2/Hosted-LocalTools/Program.cs | 10 +++++----- .../HostedAgentsV2/Hosted-McpTools/Program.cs | 10 +++++----- .../HostedAgentsV2/Hosted-Workflows/Program.cs | 10 +++++----- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-FoundryAgent/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-FoundryAgent/Program.cs index 7f509084c0..11069c6403 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-FoundryAgent/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-FoundryAgent/Program.cs @@ -66,26 +66,26 @@ internal sealed class DevTemporaryTokenCredential : TokenCredential public DevTemporaryTokenCredential() { - _token = Environment.GetEnvironmentVariable(EnvironmentVariable); + this._token = Environment.GetEnvironmentVariable(EnvironmentVariable); } public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) { - return GetAccessToken(); + return this.GetAccessToken(); } public override ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) { - return new ValueTask(GetAccessToken()); + return new ValueTask(this.GetAccessToken()); } private AccessToken GetAccessToken() { - if (string.IsNullOrEmpty(_token)) + if (string.IsNullOrEmpty(this._token)) { throw new CredentialUnavailableException($"{EnvironmentVariable} environment variable is not set."); } - return new AccessToken(_token, DateTimeOffset.UtcNow.AddHours(1)); + return new AccessToken(this._token, DateTimeOffset.UtcNow.AddHours(1)); } } diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-LocalTools/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-LocalTools/Program.cs index f1b2f7e3bd..2a296f6ee4 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-LocalTools/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-LocalTools/Program.cs @@ -143,22 +143,22 @@ internal sealed class DevTemporaryTokenCredential : TokenCredential public DevTemporaryTokenCredential() { - _token = Environment.GetEnvironmentVariable(EnvironmentVariable); + this._token = Environment.GetEnvironmentVariable(EnvironmentVariable); } public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) - => GetAccessToken(); + => this.GetAccessToken(); public override ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) - => new(GetAccessToken()); + => new(this.GetAccessToken()); private AccessToken GetAccessToken() { - if (string.IsNullOrEmpty(_token)) + if (string.IsNullOrEmpty(this._token)) { throw new CredentialUnavailableException($"{EnvironmentVariable} environment variable is not set."); } - return new AccessToken(_token, DateTimeOffset.UtcNow.AddHours(1)); + return new AccessToken(this._token, DateTimeOffset.UtcNow.AddHours(1)); } } diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-McpTools/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-McpTools/Program.cs index a969b75477..0e97e5f84f 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-McpTools/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-McpTools/Program.cs @@ -109,22 +109,22 @@ internal sealed class DevTemporaryTokenCredential : TokenCredential public DevTemporaryTokenCredential() { - _token = Environment.GetEnvironmentVariable(EnvironmentVariable); + this._token = Environment.GetEnvironmentVariable(EnvironmentVariable); } public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) - => GetAccessToken(); + => this.GetAccessToken(); public override ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) - => new(GetAccessToken()); + => new(this.GetAccessToken()); private AccessToken GetAccessToken() { - if (string.IsNullOrEmpty(_token)) + if (string.IsNullOrEmpty(this._token)) { throw new CredentialUnavailableException($"{EnvironmentVariable} environment variable is not set."); } - return new AccessToken(_token, DateTimeOffset.UtcNow.AddHours(1)); + return new AccessToken(this._token, DateTimeOffset.UtcNow.AddHours(1)); } } diff --git a/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-Workflows/Program.cs b/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-Workflows/Program.cs index 6288e3cf5f..955bff62d0 100644 --- a/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-Workflows/Program.cs +++ b/dotnet/samples/04-hosting/FoundryHostedAgents/HostedAgentsV2/Hosted-Workflows/Program.cs @@ -76,22 +76,22 @@ internal sealed class DevTemporaryTokenCredential : TokenCredential public DevTemporaryTokenCredential() { - _token = Environment.GetEnvironmentVariable(EnvironmentVariable); + this._token = Environment.GetEnvironmentVariable(EnvironmentVariable); } public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) - => GetAccessToken(); + => this.GetAccessToken(); public override ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) - => new(GetAccessToken()); + => new(this.GetAccessToken()); private AccessToken GetAccessToken() { - if (string.IsNullOrEmpty(_token)) + if (string.IsNullOrEmpty(this._token)) { throw new CredentialUnavailableException($"{EnvironmentVariable} environment variable is not set."); } - return new AccessToken(_token, DateTimeOffset.UtcNow.AddHours(1)); + return new AccessToken(this._token, DateTimeOffset.UtcNow.AddHours(1)); } }