-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add missing System.Formats.Tar docs #74786
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,11 @@ public GnuTarEntry(TarEntryType entryType, string entryName) | |
| /// <summary> | ||
| /// Initializes a new <see cref="GnuTarEntry"/> instance by converting the specified <paramref name="other"/> entry into the GNU format. | ||
| /// </summary> | ||
| /// <param name="other">The <see cref="TarEntry"/> instance to convert to the GNU format.</param> | ||
| /// <exception cref="InvalidOperationException"><para><paramref name="other"/> is a <see cref="PaxGlobalExtendedAttributesTarEntry"/> instance.</para> | ||
| /// <para>-or-</para> | ||
| /// <para>The entry type of <paramref name="other"/> is not supported in the GNU format.</para></exception> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same for this exception. |
||
| /// <exception cref="FormatException">The format of <paramref name="other"/> is invalid.</exception> | ||
carlossanlop marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public GnuTarEntry(TarEntry other) | ||
| : base(other, TarEntryFormat.Gnu) | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Shouldn't this be ArgumentException? InvalidOperationException conveys a state error.
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.
It's what TarHelpers throws in the
base.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.
It is not possible to convert a PAX GEA entry to any other type. So your code is in an invalid state at this point for attempting that.
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.
It's the object's current state, not the code's. There's no object until the ctor returns, I think it is even wrong to throw InvalidOperation in a ctor.
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.
cc @bartonjs as we recently discussed similar cases.
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'm wondering: if we change the exception type, it wouldn't meet the 7.0 servicing bar and if we change it on 8.0, it would imply a breaking change (which may not be worth it?). So this is not actionable until proven otherwise (customer feedback, etc.).
cc @danmoseley, is my reasoning correct?
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.
@jozkee is correct, in new code this should be an ArgumentException because
InvalidOperationExceptionmeans "you asked an object to do something, and that makes no sense right now". That could be "I'm in readonly mode and you invoked a mutation member", or "this method can't be called until some property is set" or "this method can't be called because you passed null in the ctor", or whatever.HAL's "I'm afraid I can't do that, Dave." is
InvalidOperationExceptionthrown fromhal.OpenDoors(DoorTypes.PodBay)... "I" can't do that, because of something that happened outside of this request.hal.OpenDoors(DoorTypes.PodBay | DoorTypes.EmergencyAirlockExterior)might throw an ArgumentException that only a single value can be requested, and that would, in HAL-ese, be "You know I can only open one kind of door at a time, Dave." (the error is Dave's, so ArgumentException)).If @danmoseley 's Dan-mocracy is a De-mocracy, then I'll vote for fixing the exception type in the product code.
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.
The user is asking to convert this PaxGEA entry to another type, and that doesn't make sense right now, or ever.
So maybe the text should be changed?
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.
Right, so InvalidOperationException is the wrong exception. The exception isn't conditional on the target object's state (no fields/properties were consulted before the throw)
https://docs.microsoft.com/en-us/dotnet/api/system.invalidoperationexception?view=net-6.0
and from the remarks:
Since the reason here is entirely invalid arguments (the combination of "this method" (constructor) and "this argument" will NEVER work), it should be an ArgumentException.
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.
Ok, I submitted it as a separate change to keep it as minimal as possible for a potential backport: #74845
The documentation changes in this PR should not matter for RC2, since intellisense will come from whatever we put in dotnet-api-docs.