Skip to content
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

[dotnet] Annotate nullability on Target protocol #15240

Merged
merged 2 commits into from
Feb 6, 2025

Conversation

RenderMichael
Copy link
Contributor

@RenderMichael RenderMichael commented Feb 5, 2025

User description

Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Annotate nullability on Target protocol

Motivation and Context

Contributes to #14640

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Enhancement


Description

  • Annotated nullability for Target protocol and related classes.

  • Added nullability checks and exceptions for constructor parameters.

  • Updated method signatures to support nullable parameters.

  • Enabled nullable reference types in affected files.


Changes walkthrough 📝

Relevant files
Enhancement
Target.cs
Added nullability annotations to `Target` class                   

dotnet/src/webdriver/DevTools/Target.cs

  • Enabled nullable reference types.
  • Updated event handlers to allow nullable types.
  • Adjusted method signatures to support nullable parameters.
  • +6/-4     
    V130Target.cs
    Added nullability annotations to `V130Target` class           

    dotnet/src/webdriver/DevTools/v130/V130Target.cs

  • Enabled nullable reference types.
  • Added nullability checks for constructor parameters.
  • Updated method signatures to support nullable parameters.
  • Simplified null checks in methods.
  • +13/-12 
    V131Target.cs
    Added nullability annotations to `V131Target` class           

    dotnet/src/webdriver/DevTools/v131/V131Target.cs

  • Enabled nullable reference types.
  • Added nullability checks for constructor parameters.
  • Updated method signatures to support nullable parameters.
  • Simplified null checks in methods.
  • +13/-12 
    V132Target.cs
    Added nullability annotations to `V132Target` class           

    dotnet/src/webdriver/DevTools/v132/V132Target.cs

  • Enabled nullable reference types.
  • Added nullability checks for constructor parameters.
  • Updated method signatures to support nullable parameters.
  • Simplified null checks in methods.
  • +13/-12 
    V85Target.cs
    Added nullability annotations to `V85Target` class             

    dotnet/src/webdriver/DevTools/v85/V85Target.cs

  • Enabled nullable reference types.
  • Added nullability checks for constructor parameters.
  • Updated method signatures to support nullable parameters.
  • Simplified null checks in methods.
  • +11/-7   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    qodo-merge-pro bot commented Feb 5, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Event Handler Safety

    The TargetDetached and TargetAttached events are marked as nullable but there are no null checks when raising these events. This could lead to NullReferenceException if handlers are removed.

    public event EventHandler<TargetDetachedEventArgs>? TargetDetached;
    
    /// <summary>
    /// Occurs when a target is attached.
    /// </summary>
    public event EventHandler<TargetAttachedEventArgs>? TargetAttached;

    Copy link
    Contributor

    qodo-merge-pro bot commented Feb 5, 2025

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @RenderMichael
    Copy link
    Contributor Author

    Failures are unrelated to this PR

    //java/test/org/openqa/selenium/mobile:NetworkConnectionTest
    //java/test/org/openqa/selenium/remote:RemoteWebDriverScreenshotTest
    //java/test/org/openqa/selenium/remote:RemoteWebDriverScreenshotTest-firefox-beta
    //rb/spec/integration/selenium/webdriver:network-firefox-beta-bidi
    //rb/spec/integration/selenium/webdriver:network-firefox-bidi

    @RenderMichael RenderMichael merged commit ef67b61 into SeleniumHQ:trunk Feb 6, 2025
    9 of 10 checks passed
    @RenderMichael RenderMichael deleted the nullable-target branch February 6, 2025 05:28
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant