-
Notifications
You must be signed in to change notification settings - Fork 386
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
Issue 2279 #2282
Open
samcoppock
wants to merge
7
commits into
dotnet:main
Choose a base branch
from
samcoppock:issue_2279
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Issue 2279 #2282
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e023a78
Fix issue 2279
c3c1333
#2279 - add test
7a87dc9
2279 - remove unused declarations
43d2c18
#2279 - fix test
1847bcc
2279 - fix completioncontext issue 2279
4d8d7e8
add some tests - 2279
abe31f9
2279 - fix bug where = sign could not be used in a CLi option value
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 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 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.
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.
Does this new test demonstrate the bug, i.e. fail if the bug is not fixed? The call stack of the exception in the issue included ParseResult.GetCompletions, but this test does not seem to call that function.
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.
Ive checked and surprisingly - no it does not.
when i manually run the following code manually ( with or without a debugger ) it throws an error before I apply my fix ( only if the argument has a = symbol separating the key value ) and after I apply my fix it works. - IE exactly what it should do.
` CliRootCommand _outerCommand = new CliRootCommand
{
new CliCommand("inner")
{
new CliOption("--optionOne"),
new CliOption("--optionTwo")
}
};
`
Within my test I have almost exactly the same code - the only differences are _outerCommand is now named command and the command line string is now defined in a variable before the command is called.
neither of these issues should have changed it.
However when i reverted my fix the test still worked.
I tried adding a check to detect the 'InvalidOperationException' and it made no difference
I tried the following test code and its not failing without my fix being applied ( note i added the manual "throw new InvalidOperationException("hello");" to prove that my test is correctly detecting errors, I also ran it without this line )
` public void CommandLineText_is_parsed_when_option_is_in_name_equals_sign_value_format()
{
I dont know what to do here or why my functionally identical code is behaving differently when it runs in test.
Advice would be appreciated.
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.
Perhaps the argument of GetCompletions makes a difference. In #2279 (comment),
which would presumably call GetCompletions(30). Your code above calls
result.GetCompletions()
instead.The length of
CompletionCrashRepro --test=asd
is 31 characters. I think 30 then means the insertion point would have been between--test=as
andd
.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.
also
i tried adding 'System.Environment.Exit(2);' to 'GetWordToComplete' in 'CompletionContext.cs' and running the test and non of them fail which shows that none of the tests run this piece of code.
They do exit when running the code manually.
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 suggest you run the test in a debugger and trace why it doesn't go to GetWordToComplete.
It might be related to how the CliRootCommand constructor uses CliRootCommand.ExecutableName as the name of the command. CliRootCommand derives that from
Environment.GetCommandLineArgs()[0]
, which would differ between the test runner process and your experimental application.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.
test fixed - its working properly now.
please finish reviwing