Skip to content

Api Convention-related types missing from Microsoft.AspNetCore.Mvc.Core 2.3.0 #61955

@julealgon

Description

@julealgon

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

As part of a process to upgrade our NET472 applications from AspNetCore 2.2 to the newer 2.3 packages, we started getting build failures when we got to upgrading the Microsoft.AspNetCore.Mvc.Core NuGet from version 2.2.2 to 2.3.0, as multiple types related to API conventions appear to be completely missing from this specific version of the package.

Here is a list of some of the types that are missing:

  • ProducesDefaultResponseTypeAttribute
  • ApiConventionNameMatchAttribute
  • ApiConventionNameMatchBehavior
  • ApiConventionTypeMatchBehavior
  • ApiConventionTypeAttribute

Since we are using a custom API convention class, this broke our project and we cannot move forward without removing our convention, which I would like to avoid doing.

Expected Behavior

All types from previous versions of the Microsoft.AspNetCore.Mvc.Core package should still be present in the 2.3.0 version, including those related to API conventions.

Steps To Reproduce

https://github.com/julealgon/issueRepros-aspnetcore-missingApiConventionTypes

  1. Open the solution, observe compilation fails.
  2. Change version of the package in project from 2.3.0 to 2.2.0
  3. Observe compilation now succeeds

Exceptions (if any)

No response

.NET Version

NET472

Anything else?

It's not clear to me exactly why these specific types are missing, but I'm currently assuming it must be something related to trimming that removed these types during build.

I actually downloaded the nuget package directly to make sure those types were really not there, and confirmed they are also missing from the documentation XML inside of the package, meaning they were eliminated completely before the final dll was generated somehow.

Upgrading the consuming project makes no difference whatsoever (I tried just to see if it would make a difference, from net472 to net9.0 for example).

The latest version from the AspNetCore.AppRef is working just fine (again, tested by removing the explicit package, and changing to the .Web project SDK).

The only workaround for us at the moment seems to be to completely remove our custom API convention class. Nothing else was affected apparently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Status: Resolvedneeds-area-labelUsed by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions