-
Notifications
You must be signed in to change notification settings - Fork 216
Turn on AnalysisMode=all in C# #350
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
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.
PR Overview
This PR enables AnalysisMode=all in C# and updates several files to comply with stricter analysis requirements. The changes include:
- Changing GreeterService from internal to public in two separate locations.
- Updating Program.cs to use CultureInfo.CurrentCulture when formatting the timestamp.
- Replacing manual null checks with ArgumentNullException.ThrowIfNull in two SimpleWakeUpService.cs files for a more modern and concise approach.
Reviewed Changes
| File | Description |
|---|---|
| csharp/IceBox/Greeter/Service/GreeterService.cs | Changed accessibility from internal to public |
| csharp/IceGrid/IceBox/Service/GreeterService.cs | Changed accessibility from internal to public |
| csharp/IceStorm/Weather/Sensor/Program.cs | Introduced CultureInfo usage for timestamp formatting |
| csharp/Ice/Callback/Server/SimpleWakeUpService.cs | Replaced null check with ArgumentNullException.ThrowIfNull |
| csharp/Glacier2/Callback/Server/SimpleWakeUpService.cs | Replaced null check with ArgumentNullException.ThrowIfNull |
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
| dotnet_code_quality_unused_parameters = all:suggestion | ||
|
|
||
| # Diagnostic preferences | ||
| dotnet_diagnostic.CA5394.severity = none # Do not use insecure randomness |
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.
Otherwise, can't use the pseudo-random generator System.Random.
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.
Instead we should be using RandomNumberGenerator.GetInt32 like we do in IceRPC.
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.
Will fix in a follow-up PR.
| <ImplicitUsings>true</ImplicitUsings> | ||
| <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
| <!-- <AnalysisMode>All</AnalysisMode> --> | ||
| <ImplicitUsings>enable</ImplicitUsings> |
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.
This is / should be specified in all .csproj files.
No description provided.