Skip to content

Conversation

stephentoub
Copy link
Member

@stephentoub stephentoub commented Sep 30, 2025

Fixes #6864

Microsoft Reviewers: Open in CodeFlow

@stephentoub stephentoub requested review from a team as code owners September 30, 2025 02:45
@github-actions github-actions bot added the area-ai Microsoft.Extensions.AI libraries label Sep 30, 2025
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

This PR re-enables the IDE0032 analyzer rule ("Use auto property") which was previously disabled due to issue #6864. The changes convert manual property implementations with backing fields to use C# 13's field keyword for auto-implemented properties, providing a cleaner and more modern approach to property definitions.

Key changes include:

  • Converting backing field properties to use the field keyword
  • Updating EditorConfig files to enable IDE0032 as a warning instead of silent
  • Adjusting StyleCop rules SA1500 and SA1513 to suggestion level to accommodate field-based property initializers

Reviewed Changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 3 comments.

File Description
Multiple .editorconfig files Enable IDE0032 rule and adjust StyleCop rules for field-based properties
Various source files Convert backing field properties to use field keyword syntax
DataContent.cs Add pragma to disable IDE0032 (likely due to specific constraints)
FunctionInvokingChatClient.cs Remove pragma disabling IDE0032 and convert properties

Copy link
Contributor

@shyamnamboodiripad shyamnamboodiripad left a comment

Choose a reason for hiding this comment

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

Thanks for fixing!

@stephentoub stephentoub merged commit c378af0 into dotnet:main Sep 30, 2025
7 checks passed
@stephentoub stephentoub deleted the ide0032 branch September 30, 2025 04:33
}
get;
set => field = Throw.IfNull(value);
} = AIJsonUtilities.DefaultOptions;
Copy link
Member

Choose a reason for hiding this comment

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

Did you manually fix this one up? I was getting this on a separate line when using dotnet format.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see it was because of SA1500 and SA1513 being enabled as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup. Those stylecop rules need to be updated to accomodate C# 14 features.

This was referenced Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai Microsoft.Extensions.AI libraries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reenable IDE0032 Use auto property

4 participants