Skip to content

Conversation

@huulinhnguyen-dev
Copy link
Contributor

@huulinhnguyen-dev huulinhnguyen-dev commented May 22, 2025

Fixes #
Fix the issue #10007 the message not display the name of the attribute type whose definition it did not find

Context

When using the MSBuild with WriteCodeFragment in .csproj file, if the positional constructor parameters, use metadata names that resemble _Parameter1, _Parameter2 and the Attribute cannot found, the message display "Could not infer the type of parameter "#1" because the attribute type is unknown. The value will be treated as a string" instead of the name of the parameters"

Changes Made

Make the message display the name of the parameters instead of the index
Add a UnitTest for this case

Testing

Build a .csproj file with WriteCodeFragment and using an Attribute cannot found with the positional constructor parameters

Notes

@huulinhnguyen-dev huulinhnguyen-dev marked this pull request as ready for review May 23, 2025 08:47
Co-authored-by: Tomas Bartonek <[email protected]>
@MichalPavlik MichalPavlik requested a review from JanProvaznik May 27, 2025 14:04
@AR-May AR-May assigned huulinhnguyen-dev and AR-May and unassigned AR-May Jun 9, 2025
@AR-May AR-May self-requested a review June 9, 2025 11:49
Copy link
Member

@AR-May AR-May left a comment

Choose a reason for hiding this comment

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

LGTM, just a small suggestion for better wording.

@JanProvaznik JanProvaznik changed the title Change to report the name of attribute type instead of the index when… WriteCodeFragment report name of attribute type instead of idx Jun 10, 2025
@JanProvaznik JanProvaznik merged commit 87bb9bd into dotnet:main Jun 10, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants