Skip to content

Conversation

huulinhnguyen-dev
Copy link
Contributor

Fixes #
Fix the issue #10007 the message just display the name of the metadata that holds the parameter value but 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

Add the name of the attribute type into the message when the definitions cannot find

Testing

Build a .csproj file with WriteCodeFragment and using an Attribute cannot found with and the message display look like this
Could not infer the type of parameter "_Parameter1" because the attribute type "System.TheAttributeCannotFound" is unknown. The value will be treated as a string.

Notes

@huulinhnguyen-dev huulinhnguyen-dev marked this pull request as ready for review June 13, 2025 07:13
@huulinhnguyen-dev huulinhnguyen-dev changed the title Add the name of the attribute type name into the message when the definition cannot find Add the name of the attribute type into the message when the definition cannot find Jun 13, 2025
@GangWang01 GangWang01 merged commit 5deefbf into dotnet:main Jun 18, 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