Skip to content

Add StringSyntax format attributes to methods and parameters #62179

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

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions src/Components/Web/src/Routing/NavigationLock.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Source-Build (Managed))

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM64)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux x64)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl x64)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux Musl ARM64)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS x64)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: Linux ARM)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: Ubuntu x64)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Build: macOS arm64)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: Ubuntu x64)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr (Tests: macOS)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci (Build Test: macOS)

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-quarantined-pr

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)

Check failure on line 4 in src/Components/Web/src/Routing/NavigationLock.cs

View check run for this annotation

Azure Pipelines / aspnetcore-ci

src/Components/Web/src/Routing/NavigationLock.cs#L4

src/Components/Web/src/Routing/NavigationLock.cs(4,1): error IDE0005: (NETCORE_ENGINEERING_TELEMETRY=Build) Using directive is unnecessary. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0005)
using System.Globalization;
using Microsoft.JSInterop;

Expand Down
5 changes: 3 additions & 2 deletions src/Mvc/Mvc.ViewFeatures/src/IHtmlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Rendering;
using System.Diagnostics.CodeAnalysis;

namespace Microsoft.AspNetCore.Mvc.ViewFeatures;

Expand Down Expand Up @@ -36,7 +37,7 @@ public interface IHtmlGenerator
/// <param name="value">The value to format.</param>
/// <param name="format">The format to use.</param>
/// <returns>The formatted value.</returns>
string FormatValue(object value, string format);
string FormatValue(object value, [StringSyntax(StringSyntaxAttribute.NumericFormat)] string format);

/// <summary>
/// Generate a &lt;a&gt; element for a link to an action.
Expand Down Expand Up @@ -503,7 +504,7 @@ TagBuilder GenerateTextBox(
ModelExplorer modelExplorer,
string expression,
object value,
string format,
[StringSyntax(StringSyntaxAttribute.NumericFormat)] string format,
object htmlAttributes);

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/Mvc/Mvc.ViewFeatures/src/ModelExplorerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;

namespace Microsoft.AspNetCore.Mvc.ViewFeatures;
Expand Down
1 change: 1 addition & 0 deletions src/Mvc/Mvc.ViewFeatures/src/TemplateBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.ModelBinding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down
Loading