Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 2, 2025

  • Update src/Shared/Obsoletions.cs to add ASPDEPR URL constants
  • Update all ASPDEPR002 obsoletions to use UrlFormat parameter with Obsoletions constant
  • Update all ASPDEPR003 obsoletions to use UrlFormat parameter with Obsoletions constant
  • Update all ASPDEPR004 obsoletions to use UrlFormat parameter with Obsoletions constant
  • Update all ASPDEPR005 obsoletions to use UrlFormat parameter with Obsoletions constant
  • Update all ASPDEPR006 obsoletions to use UrlFormat parameter with Obsoletions constant
  • Update all ASPDEPR008 obsoletions to use UrlFormat parameter with Obsoletions constant
  • Update all ASPDEPR009 obsoletions to use UrlFormat parameter with Obsoletions constant
  • Add Obsoletions.cs as linked file to all projects using ASPDEPR diagnostics
  • Build and test changes to ensure no regressions

Summary

Updated all ASPDEPR obsoletions to use specific URL constants that point to the correct aka.ms documentation links with numeric diagnostic IDs. This ensures that when developers see these deprecation warnings in Visual Studio, the URLs will correctly link to documentation pages using just the numeric portion of the diagnostic ID.

Changes Made:

  1. Created specific URL constants - Instead of using a format string with {0} placeholder that would produce incorrect URLs, defined individual constants for each diagnostic in src/Shared/Obsoletions.cs:

    • AspNetCoreDeprecate002Urlhttps://aka.ms/aspnet/deprecate/002
    • AspNetCoreDeprecate003Urlhttps://aka.ms/aspnet/deprecate/003
    • AspNetCoreDeprecate004Urlhttps://aka.ms/aspnet/deprecate/004
    • AspNetCoreDeprecate005Urlhttps://aka.ms/aspnet/deprecate/005
    • AspNetCoreDeprecate006Urlhttps://aka.ms/aspnet/deprecate/006
    • AspNetCoreDeprecate008Urlhttps://aka.ms/aspnet/deprecate/008
    • AspNetCoreDeprecate009Urlhttps://aka.ms/aspnet/deprecate/009
  2. Updated all UrlFormat references - Changed all 26 obsolete attribute declarations across 20 source files to use the specific URL constants (e.g., UrlFormat = Obsoletions.AspNetCoreDeprecate003Url)

  3. Added using directive - Added using Microsoft.AspNetCore.Shared; to all files that reference the Obsoletions constants

  4. Linked Obsoletions.cs file - Added <Compile Include="$(SharedSourceRoot)Obsoletions.cs" LinkBase="Shared" /> to 10 project files that didn't already have it:

    • Microsoft.AspNetCore.HttpOverrides.csproj
    • Microsoft.AspNetCore.OpenApi.csproj
    • Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.csproj
    • Microsoft.AspNetCore.Mvc.Core.csproj
    • Microsoft.AspNetCore.Hosting.Abstractions.csproj
    • Microsoft.AspNetCore.Hosting.csproj
    • Microsoft.AspNetCore.Hosting.WindowsServices.csproj
    • Microsoft.AspNetCore.TestHost.csproj
    • Microsoft.AspNetCore.csproj
    • Microsoft.AspNetCore.Mvc.Testing.csproj

This approach ensures that URLs like https://aka.ms/aspnet/deprecate/003 are generated (with just the numeric part) instead of https://aka.ms/aspnet/deprecate/ASPDEPR003 (which would be incorrect), aligning with the existing aka.ms link structure.

All projects build successfully with the updated references.

Original prompt

implement this.

[Chronological Review: The conversation began with the user requesting a list of obsoletions in the codebase that utilize ASPDEPR warnings. The user aimed to ensure these were documented in official documentation and to log issues for any missing documentation. The user then asked to validate links related to these obsoletions. Following this, the user sought to identify who made the changes that added the warnings for issue tracking. The user expressed concern that some obsoletions lacked a URLFormat in the ObsoleteAttribute, which could lead to broken links in Visual Studio. Finally, the user requested implementation of changes to fix these issues.]

[Intent Mapping:

  1. "Can you please help me find the list of all of the different obsoletions we have in the codebase where we use ASPDEPR warnings?" - User wants to document obsoletions.
  2. "Can you try navigating to those 8 links and validate if there is valid docs with their deprecation?" - User wants to ensure documentation is accurate.
  3. "Can you help me figure out who made the change that added this warning?" - User seeks accountability for fixing documentation links.
  4. "I was looking at the code and it seems that for at least some of those ASPDEPR obsoletions we are not really providing a URLFormat..." - User identifies a specific issue with the code.
  5. "implement this." - User requests implementation of the identified changes.]

[Technical Inventory:

  • ASPDEPR warnings: Used for marking deprecated code.
  • ObsoleteAttribute: Attribute used to indicate that a method or class is obsolete.
  • URLFormat: A property of the ObsoleteAttribute that provides a link to documentation.]

[Code Archaeology:

  • File: /home/joperezr/aspnetcore/src/Http/Routing/src/Patterns/RoutePatternException.cs
  • The user is currently focused on this file, particularly around line 50, where they are likely examining obsoletions.]

[Progress Assessment:

  • Completed: User has identified the need for documentation and accountability for obsoletions.
  • Pending: User needs to implement changes to add URLFormat to the ObsoleteAttribute for identified obsoletions.]

[Context Validation: All critical information for continuation is captured, including the need to document obsoletions and fix URLFormat issues.]

[Recent Commands Analysis:

  • Last Agent Commands: User requested to "implement this," indicating a desire to proceed with changes related to URLFormat for obsoletions.
  • Tool Results Summary: No specific tool results were returned as the user was focused on code changes.
  • Pre-Summary State: The agent was actively working on implementing changes to the codebase to address the lack of URLFormat in obsoletions.
  • Operation Context: These commands were executed to ensure that the documentation for deprecated code is accurate and accessible.]
1. Conversation Overview: - Primary Objectives: - "Can you please help me find the list of all of the different obsoletions we have in the codebase where we use ASPDEPR warnings?" - "Can you try navigating to those 8 links and validate if there is valid docs with their deprecation?" - "Can you help me figure out who made the change that added this warning?" - "I was looking at the code and it seems that for at least some of those ASPDEPR obsoletions we are not really providing a URLFormat..." - "implement this." - Session Context: The user is focused on ensuring that deprecated code is properly documented and that any broken links in Visual Studio are fixed. - User Intent Evolution: The user started with a broad request for documentation, narrowed down to specific issues with URLFormat, and concluded with a request for implementation.
  1. Technical Foundation:
  • ASPDEPR Warnings: Used to mark deprecated code.
  • ObsoleteAttribute: Indicates that a method or class is obsolete, with a URLFormat for documentation.
  • URLFormat: A property that provides a link to relevant documentation.
  1. Codebase Status:
  • File Name: RoutePatternException.cs
  • Purpose: Handles exceptions related to routing patterns.
  • Current State: User is examining obsoletions and their documentation.
  • Key Code Segments: Focus on the ObsoleteAttribute and its URLFormat.
  • Dependencies: Related to routing and HTTP handling in ASP.NET Core.
  1. Problem Resolution:
  • Issues Encountered: Missing URLFormat in some ASPDEPR obsoletions.
  • Solutions Implemented: User has identified the need for changes but has not yet implemented them.
  • Debugging Context: Ongoing examination of obsoletions and their documentation links.
  • Lessons Learned: Importance of providing accurate documentation links for deprecated code.
  1. Progress Tracking:
  • Completed Tasks: Identification of obsoletions and the need for documentation.
  • Partially Complete Work: Implementation of URLFormat changes is pending.
  • Validated Outcomes: User has confirmed the need for documentation improvements.
  1. Active Work State:
  • Current Focus: Implementi...
Created from VS Code via the [GitHub Pull Request](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github) extension.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: joperezr <13854455+joperezr@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Adding UrlFormat to ObsoleteAttribute in ASPDEPR Add UrlFormat to ObsoleteAttribute for ASPDEPR diagnostics Oct 2, 2025
@Copilot Copilot AI requested a review from joperezr October 2, 2025 22:20
Copilot finished work on behalf of joperezr October 2, 2025 22:20
…lFormat references

Co-authored-by: joperezr <13854455+joperezr@users.noreply.github.com>
@Copilot Copilot AI requested a review from joperezr October 2, 2025 22:46
Copilot finished work on behalf of joperezr October 2, 2025 22:46
@joperezr joperezr marked this pull request as ready for review October 2, 2025 22:51
@Copilot Copilot AI review requested due to automatic review settings October 2, 2025 22:51
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds UrlFormat parameter with shared constant to all ASPDEPR obsoletions to ensure consistent documentation links and simplify future URL updates.

  • Added AspNetCoreSharedUrlFormat constant to shared Obsoletions.cs
  • Updated all ASPDEPR obsoletions to use the shared URL format constant instead of hardcoded strings
  • Linked Obsoletions.cs to projects that didn't already have it

Reviewed Changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Shared/Obsoletions.cs Added AspNetCoreSharedUrlFormat constant for ASPDEPR URLs
src/OpenApi/src/Microsoft.AspNetCore.OpenApi.csproj Added Obsoletions.cs as linked file
src/OpenApi/src/Extensions/OpenApiEndpointConventionBuilderExtensions.cs Updated ASPDEPR002 obsoletions to use shared URL format
src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs Updated ASPDEPR008 obsoletions to use shared URL format
src/Mvc/Mvc.Testing/src/Microsoft.AspNetCore.Mvc.Testing.csproj Added Obsoletions.cs as linked file
src/Mvc/Mvc.Razor.RuntimeCompilation/src/MvcRazorRuntimeCompilationOptions.cs Updated ASPDEPR003 obsoletion to use shared URL format
src/Mvc/Mvc.Razor.RuntimeCompilation/src/Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.csproj Added Obsoletions.cs as linked file
src/Mvc/Mvc.Razor.RuntimeCompilation/src/FileProviderRazorProjectItem.cs Updated ASPDEPR003 obsoletion to use shared URL format
src/Mvc/Mvc.Razor.RuntimeCompilation/src/DependencyInjection/RazorRuntimeCompilationMvcCoreBuilderExtensions.cs Updated ASPDEPR003 obsoletion to use shared URL format
src/Mvc/Mvc.Razor.RuntimeCompilation/src/DependencyInjection/RazorRuntimeCompilationMvcBuilderExtensions.cs Updated ASPDEPR003 obsoletion to use shared URL format
src/Mvc/Mvc.Razor.RuntimeCompilation/src/AssemblyPartExtensions.cs Updated ASPDEPR003 obsoletion to use shared URL format
src/Mvc/Mvc.Core/src/Microsoft.AspNetCore.Mvc.Core.csproj Added Obsoletions.cs as linked file
src/Mvc/Mvc.Core/src/Infrastructure/IActionContextAccessor.cs Updated ASPDEPR006 obsoletion to use shared URL format
src/Mvc/Mvc.Core/src/Infrastructure/ActionContextAccessor.cs Updated ASPDEPR006 obsoletion to use shared URL format
src/Middleware/HttpOverrides/src/Microsoft.AspNetCore.HttpOverrides.csproj Added Obsoletions.cs as linked file
src/Middleware/HttpOverrides/src/IPNetwork.cs Updated ASPDEPR005 obsoletion to use shared URL format
src/Middleware/HttpOverrides/src/ForwardedHeadersOptions.cs Updated ASPDEPR005 obsoletion to use shared URL format
src/Hosting/WindowsServices/src/WebHostWindowsServiceExtensions.cs Updated ASPDEPR009 obsoletion to use shared URL format
src/Hosting/WindowsServices/src/WebHostService.cs Updated ASPDEPR009 obsoletion to use shared URL format
src/Hosting/WindowsServices/src/Microsoft.AspNetCore.Hosting.WindowsServices.csproj Added Obsoletions.cs as linked file
src/Hosting/TestHost/src/WebHostBuilderExtensions.cs Updated ASPDEPR008 obsoletions to use shared URL format
src/Hosting/TestHost/src/TestServer.cs Updated ASPDEPR008 obsoletions to use shared URL format
src/Hosting/TestHost/src/Microsoft.AspNetCore.TestHost.csproj Added Obsoletions.cs as linked file
src/Hosting/Hosting/src/WebHostExtensions.cs Updated ASPDEPR008 obsoletion to use shared URL format
src/Hosting/Hosting/src/WebHostBuilder.cs Updated ASPDEPR004 obsoletion to use shared URL format
src/Hosting/Hosting/src/Microsoft.AspNetCore.Hosting.csproj Added Obsoletions.cs as linked file
src/Hosting/Abstractions/src/Microsoft.AspNetCore.Hosting.Abstractions.csproj Added Obsoletions.cs as linked file
src/Hosting/Abstractions/src/IWebHostBuilder.cs Updated ASPDEPR008 obsoletion to use shared URL format
src/Hosting/Abstractions/src/IWebHost.cs Updated ASPDEPR008 obsoletion to use shared URL format
src/DefaultBuilder/src/WebHost.cs Updated ASPDEPR008 obsoletion to use shared URL format
src/DefaultBuilder/src/Microsoft.AspNetCore.csproj Added Obsoletions.cs as linked file

@joperezr
Copy link
Member

joperezr commented Oct 2, 2025

cc: @BrennanConroy @captainsafia @danroth27 this is ready for review.

internal sealed class Obsoletions
{
internal const string RuntimeSharedUrlFormat = "https://aka.ms/dotnet-warnings/{0}";
internal const string AspNetCoreSharedUrlFormat = "https://aka.ms/aspnet/deprecate/{0}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will end up being https://aka.ms/aspnet/deprecate/aspdepr003? Not https://aka.ms/aspnet/deprecate/003

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot can you take a look at this comment and fix appropriately? The aka.ms link format should take the number part of the id as opposed to the full diagnosticID in order for this to work with the existing aka.ms links.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit that will be pushed. Changed from using a format string with {0} placeholder to individual URL constants for each diagnostic (e.g., AspNetCoreDeprecate003Url = "https://aka.ms/aspnet/deprecate/003"). This ensures the URLs use just the numeric part (003) instead of the full diagnostic ID (ASPDEPR003).

@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Oct 10, 2025
Co-authored-by: joperezr <13854455+joperezr@users.noreply.github.com>
@Copilot Copilot AI requested a review from joperezr October 10, 2025 19:47
Copilot finished work on behalf of joperezr October 10, 2025 19:47
@joperezr joperezr merged commit 9f255d1 into main Oct 13, 2025
30 checks passed
@joperezr joperezr deleted the copilot/fix-c65e4eb2-b75e-44e2-a413-8c2dbd5c6b1d branch October 13, 2025 21:38
@joperezr
Copy link
Member

/backport to release/10.0

Copy link
Contributor

Started backporting to release/10.0: https://github.com/dotnet/aspnetcore/actions/runs/18478908666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Attention: Shared Code Modified pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants