Remove null-forgiving operator (!) in BaseTest.AssertApkSigned#12036
Merged
jonathanpeppers merged 2 commits intoJul 13, 2026
Conversation
5 tasks
Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Remove null-forgiving operator in BaseTest.AssertApkSigned
Remove null-forgiving operator (Jul 11, 2026
!) in BaseTest.AssertApkSigned
simonrozsival
approved these changes
Jul 12, 2026
jonathanpeppers
approved these changes
Jul 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the BaseTest.AssertApkIsSigned test helper by removing a null-forgiving dereference on the Process.Start(ProcessStartInfo) result and replacing it with an explicit null check that throws a clear exception when the process fails to start.
Changes:
- Replace
proc!.StandardOutput...withProcess.Start (psi) ?? throw ...to avoid a potentialNullReferenceException. - Keep the rest of the process interaction (
StandardError,WaitForExit,ExitCode) unchanged and!-free.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Process.Startcan returnnull, but the previous code usedproc!to suppress the compiler warning, risking a rawNullReferenceExceptionon failure. Replace with an explicit?? throwto surface a clear error.Changes
BaseTest.cs: Replaceproc!.StandardOutputwith a null-coalescing throw on theProcess.Startresult:Subsequent dereferences of
proc(StandardError,WaitForExit,ExitCode) are already!-free and require no change.