Skip to content

Improve nullability.#1586

Merged
vitek-karas merged 5 commits intodotnet:mainfrom
rolfbjarne:nullability
Apr 14, 2026
Merged

Improve nullability.#1586
vitek-karas merged 5 commits intodotnet:mainfrom
rolfbjarne:nullability

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

Sprinkle nullability information in a number of places where it makes sense.

Sprinkle nullability information in a number of places where it makes sense.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds/adjusts C# nullable annotations across XHarness shared iOS and common components to better model where values may legitimately be absent (e.g., platform/configuration and environment variables), improving static null-safety across the codebase.

Changes:

  • Made many platform/configuration parameters nullable in ProjectFileExtensions APIs.
  • Updated process execution APIs to allow environment variable values to be nullable (Dictionary<string, string?>), enabling explicit removal of variables.
  • Updated logging and simulator-selection APIs with additional nullability annotations.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Microsoft.DotNet.XHarness.iOS.Shared/Utilities/ProjectFileExtensions.cs Marks platform/configuration inputs as nullable across project XML helpers.
src/Microsoft.DotNet.XHarness.iOS.Shared/IResultParser.cs Updates result parser API to allow nullable variation.
src/Microsoft.DotNet.XHarness.iOS.Shared/Hardware/SimulatorLoader.cs Adjusts simulator selection enumerable nullability.
src/Microsoft.DotNet.XHarness.iOS.Shared/Execution/MlaunchProcessManager.cs Allows nullable env-var values in mlaunch process execution APIs.
src/Microsoft.DotNet.XHarness.iOS.Shared/Execution/IMlaunchProcessManager.cs Keeps interface in sync with mlaunch manager env-var nullability changes.
src/Microsoft.DotNet.XHarness.Common/Logging/NullLog.cs Accepts nullable strings/args in the no-op logger implementation.
src/Microsoft.DotNet.XHarness.Common/Logging/Log.cs Broadens logger write APIs and WriteImpl nullability.
src/Microsoft.DotNet.XHarness.Common/Logging/ILog.cs Broadens logger interface to accept nullable strings/args.
src/Microsoft.DotNet.XHarness.Common/Execution/ProcessManager.cs Allows nullable env-var values (with removal behavior when null).
src/Microsoft.DotNet.XHarness.Common/Execution/IProcessManager.cs Keeps interface in sync with ProcessManager env-var nullability changes.
src/Microsoft.DotNet.XHarness.Apple/AppOperations/AppRunnerBase.cs Allows passing nullable env-var dictionary into Mac Catalyst app runner.
Comments suppressed due to low confidence (1)

src/Microsoft.DotNet.XHarness.Common/Logging/Log.cs:27

  • Write(string? value) can pass null through to WriteImpl (e.g., when Timestamp is false and value is null). Many existing WriteImpl overrides currently take a non-null string and may warn (nullability mismatch) or throw if they start receiving null. Consider coalescing value to string.Empty before calling WriteImpl (and keep WriteImpl non-nullable), or update all overrides to accept/handle string? safely.
    public void Write(string? value)
    {
        if (Timestamp)
        {
            value = "[" + DateTime.Now.ToString("HH:mm:ss.fffffff") + "] " + value;

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.

Comment thread src/Microsoft.DotNet.XHarness.Common/Logging/Log.cs
rolfbjarne and others added 3 commits April 13, 2026 10:48
Skip null-valued env vars when building Apple mlaunch arguments so the new nullable contract doesn't fail at runtime. Add regression tests covering the run and test simulator paths.

Co-authored-by: Copilot <[email protected]>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 36 out of 36 changed files in this pull request and generated no new comments.

@vitek-karas vitek-karas merged commit 84f48de into dotnet:main Apr 14, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants