Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fixing issue #2392#2402

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Keboo wants to merge2 commits intodotnet:main
base:main
Choose a base branch
Loading
fromKeboo:fix2392
Draft

Fixing issue #2392#2402

Keboo wants to merge2 commits intodotnet:mainfromKeboo:fix2392

Conversation

@Keboo
Copy link
Member

There were two problems addressed here.
First, the call to Diagram was causing the second error to be added to the ParseResult.Errors collection. The diagram call, was being invoked by the debugger as part of the ParseResult.ToString() method. Causing the number of errors to change when inspecting a parse result.

The second issue was the error message text. It was implying that the option expected a single value, when its arity allowed for more.

There were two problems addressed here.First, the call to Diagram was causing the second error to be added to the ParseResult.Errors collection. The diagram call, was being invoked by the debugger as part of the ParseResult.ToString() method. Causing the number of errors to change when inspecting a parse result.The second issue was the error message text. It was implying that the option expected a single value, when its arity allowed for more.
{
/// <summary>
/// Interpolates values into a localized string similar toCommand &apos;{0}&apos; expects a single argument but {1} were provided.
/// Interpolates values into a localized string similar toOption &apos;{0}&apos; expects a single argument but {1} were provided.
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this used by both options and commands?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This was to make the comment match the actual value that is getting returned. I believe the only usage is for options. I suspect this comment was wrong from a copy and paste error when we initially did the localization resources.

if(!ArgumentArity.Validate(argumentResult,outvarerror))
{
optionResult.AddError(error.ErrorMessage!);
argumentResult.AddError(error.ErrorMessage!);
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not understand this change. If this is on options, I thought we got the errors from the option. Do we get them from the option's argument?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This was one of the key fixes, that was causing the diagram command to insert a duplicate error.

The process looks like this:

  1. During the Parse, this line was invoked and the error was added to the OptionResult.
  2. The AddError method adds the error into the SymbolResultTree, and keys it based on the symbol. However,ArgumentResult.AddError method has a special case for options, whereit will use the OptionResult if that is the parent. So in either case the error is added to the SymbolResultTree with the OptionResult as the key. However, in the case of theArgumentResult.AddError it also sets the _conversionResult. So the change here still sets the error on the OptionResult, but it also causes the_conversionResult field to be set.
  3. When calling the Diagram (and likely this bug exists with other code paths as well), it will callArgumentResult.GetArgumentConversionResult. That method will callValidateAndConvert if the_conversionResult is null. CallingValidateAndConvert will add an error to the result. This was the result of the second error being added.
  4. Because Diagram was being invoked from theParseResult.ToString() it was being invoked whenever the debugger inspected a ParseResult. This was the reason for the un-usual behavior that you saw.

@KathleenDollardKathleenDollard added the PowderhouseWork to isolate parser and features labelApr 28, 2024
@KathleenDollardKathleenDollard removed the PowderhouseWork to isolate parser and features labelJun 17, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@KathleenDollardKathleenDollardKathleenDollard left review comments

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@Keboo@KathleenDollard

[8]ページ先頭

©2009-2025 Movatter.jp