-
Notifications
You must be signed in to change notification settings - Fork 838
Re-enable IDE0032 #6866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-enable IDE0032 #6866
Conversation
There was a problem hiding this 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 |
...rojectTemplates/Microsoft.Extensions.AI.Templates.IntegrationTests/Infrastructure/Project.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyService.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyService.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyService.cs
Show resolved
Hide resolved
src/Libraries/Microsoft.Extensions.AI.Evaluation.Safety/ContentSafetyService.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing!
} | ||
get; | ||
set => field = Throw.IfNull(value); | ||
} = AIJsonUtilities.DefaultOptions; |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Fixes #6864
Microsoft Reviewers: Open in CodeFlow