-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Process: throw ArgumentNullException when ArgumentList contains a null. #59562
Conversation
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process Issue DetailsFixes #44034.
|
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.cs
Outdated
Show resolved
Hide resolved
How does this fix that issue? |
The reproducer doesn't reproduce the issue. The
|
What null? And if null is being added to the collection and that's the cause, isn't this still throwing an ArgumentNullException, just with a different stack? |
The reproducer doesn't reproduce the issue. The stacktrace is correct though. |
I'm still confused. The purpose of this PR isn't to prevent an exception / change something that wasn't working into something that does work, but rather just improve where an exception comes from. Yes? |
Yes, it's validating the user doesn't add When I run:
It throws with the stacktrace from the issue.
|
And with this the exception looks like...? |
Adding Lines 14 to 22 in 3d4fac0
|
Should we ignore / tolerate null instead? A quick search in dotnet org suggests all occurrences are pretty hard to reproduce: https://github.com/search?q=org:dotnet+"String+reference+not+set+to+an+instance+of+a+String."&type=issues. Thanks for finding out the root-cause! 👍 |
We shouldn't allow I don't have a Windows machine. Looking at the code, I expect it to throw also. Now, we'll throw sooner with a more meaningful exception that indicates the input is invalid. |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessStartInfo.cs
Outdated
Show resolved
Hide resolved
fa7652c
to
ddf845b
Compare
@stephentoub I've moved the check into |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs
Outdated
Show resolved
Hide resolved
Feedback addressed, this should be good to merge. |
Thanks |
Fixes #44034.