-
Notifications
You must be signed in to change notification settings - Fork 632
share-argument-exception-extension #8098
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
base: main
Are you sure you want to change the base?
share-argument-exception-extension #8098
Conversation
@danmoseley Hello. Please look. Made a check share code |
@@ -16,6 +16,8 @@ public class RedisResource(string name) : ContainerResource(name), IResourceWith | |||
/// <param name="password">A parameter that contains the Redis server password.</param> | |||
public RedisResource(string name, ParameterResource password) : this(name) | |||
{ | |||
ArgumentNullException.ThrowIfNull(password); |
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.
where you've added new checks, do they need tests?
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.
I will add today. I will also add tests to "Builder.addgarnet ..." => "Addganet (Builder ..."
I just wanted to understand, this option is suitable for the implementation of the Share check
…sion-for-check-null-or-empty
…sion-for-check-null-or-empty
…sion-for-check-null-or-empty
…sion-for-check-null-or-empty
…sion-for-check-null-or-empty
…sion-for-check-null-or-empty
…sion-for-check-null-or-empty
@danmoseley If anything is ready, you can fill. |
…sion-for-check-null-or-empty
…sion-for-check-null-or-empty
This looks good to me. Just need the covering tests for all the other resource types. |
…rror in parallel launch
Tests should pass in all locales |
…sion-for-check-null-or-empty
…sion-for-check-null-or-empty
I think there are (at least) two ways of solving this.
|
I chose the 3rd point. You need to understand what to do with it. |
@Zombach not about this PR directly, but chatting offline, I think we want to hold off on any future large "argument validation" PR's without agreement first. Yes, code changes should validate arguments. A PR fixing a particular instance is probably fine. But any more large scale ones don't make sense right now as we're biasing for speed, and it brings the risk of regressions. |
Yes, I will make Culture fix in a separate PR. |
This reverts commit 3ca50cc.
…sion-for-check-null-or-empty
…sion-for-check-null-or-empty
…sion-for-check-null-or-empty
@@ -10,6 +10,7 @@ | |||
|
|||
<ItemGroup> | |||
<Compile Include="$(RepoRoot)src\Shared\AzureRoleAssignmentUtils.cs" /> | |||
<Compile Include="$(ComponentsDir)\Common\ArgumentExceptionExtensions.cs" Link="ArgumentExceptionExtensions.cs" /> |
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 of doing this in each project file, I suggest considering a different approach.
- If this file needs to be linked in each project, then do this injection at Directory.Build.props/targets (or alike).
- If this file needs to be conditionally linked in project, then do a conditional injection at Directory.Build.props/targets (or alike) controlled by an opt-in switch in each project.
For example: https://github.com/dotnet/extensions/blob/1e4f6c51798be661b8d8743dd464ca9f54b0c9a3/src/Libraries/Microsoft.AspNetCore.HeaderParsing/Microsoft.AspNetCore.HeaderParsing.csproj#L15C6-L15C41
@@ -10,6 +10,7 @@ | |||
|
|||
<ItemGroup> | |||
<Compile Include="$(RepoRoot)src\Shared\AzureRoleAssignmentUtils.cs" /> | |||
<Compile Include="$(ComponentsDir)\Common\ArgumentExceptionExtensions.cs" Link="ArgumentExceptionExtensions.cs" /> |
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.
Why not put the shared file in the Shared folder (like the line above)?
|
||
namespace Aspire; | ||
|
||
internal static class ArgumentExceptionExtensions |
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.
These extensions aren't very discoverable. I very much suggest taking an inspiration from https://github.com/dotnet/extensions/tree/1e4f6c51798be661b8d8743dd464ca9f54b0c9a3/src/Shared/Throw, and do the same way (both in terms of API naming and the location of the file).
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.
Ooo. This option is really good. I will do the other day
Let's merge this after the 9.3 snap |
…-exception-extension-for-check-null-or-empty
This submission has been automatically marked as stale because it has been marked as requiring author action but has not had any activity for 14 days. |
Description
message
Checklist
<remarks />
and<code />
elements on your triple slash comments?breaking-change
template):doc-idea
template):