Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[dotnet] Enable Nullable Reference Types #15354

Merged
merged 10 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions dotnet/private/executable_assembly.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def create_executable_assembly(ctx, extra_srcs, extra_deps):
internals_visible_to = None,
internals_visible_to_cs = None,
langversion = ctx.attr.langversion,
nullable = ctx.attr.nullable,
resources = ctx.files.resources,
srcs = ctx.files.srcs + extra_srcs,
out = ctx.attr.out,
Expand Down Expand Up @@ -143,6 +144,9 @@ csharp_executable = rule(
"langversion": attr.string(
doc = "The version string for the C# language.",
),
"nullable": attr.string(
doc = "Enable nullable context, or nullable warnings.",
),
"resources": attr.label_list(
doc = "A list of files to embed in the DLL as resources.",
allow_files = True,
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/webdriver/Alert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
using System;
using System.Collections.Generic;

#nullable enable

namespace OpenQA.Selenium
{
/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions dotnet/src/webdriver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ csharp_library(
"WebDriver.Common.Tests",
],
langversion = "12.0",
nullable = "enable",
resources = [
"//javascript/atoms/fragments:find-elements.js",
"//javascript/atoms/fragments:is-displayed.js",
Expand Down Expand Up @@ -76,6 +77,7 @@ csharp_library(
"WebDriver.Common.Tests",
],
langversion = "12.0",
nullable = "enable",
resources = [
"//javascript/atoms/fragments:find-elements.js",
"//javascript/atoms/fragments:is-displayed.js",
Expand Down Expand Up @@ -103,6 +105,7 @@ csharp_library(
out = "WebDriver.StrongNamed",
keyfile = "//dotnet:WebDriver.snk",
langversion = "12.0",
nullable = "enable",
resources = [
"//javascript/atoms/fragments:find-elements.js",
"//javascript/atoms/fragments:is-displayed.js",
Expand Down Expand Up @@ -140,6 +143,7 @@ csharp_library(
],
keyfile = "//dotnet:WebDriver.snk",
langversion = "12.0",
nullable = "enable",
resources = [
"//javascript/atoms/fragments:find-elements.js",
"//javascript/atoms/fragments:is-displayed.js",
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/webdriver/BiDi/BiDi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using OpenQA.Selenium.BiDi.Communication;
using OpenQA.Selenium.BiDi.Communication.Transport;

#nullable enable

namespace OpenQA.Selenium.BiDi;

public class BiDi : IAsyncDisposable
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/webdriver/BiDi/BiDiException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

using System;

#nullable enable

namespace OpenQA.Selenium.BiDi;

public class BiDiException : Exception
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/webdriver/BiDi/Communication/Broker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
using System.Threading;
using System.Threading.Tasks;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication;

public class Broker : IAsyncDisposable
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/webdriver/BiDi/Communication/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
// under the License.
// </copyright>

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication;

public abstract class Command
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/webdriver/BiDi/Communication/CommandOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

using System;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication;

public record CommandOptions
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/webdriver/BiDi/Communication/EventHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication;

public abstract class EventHandler(string eventName, Type eventArgsType, IEnumerable<BrowsingContext>? contexts = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class BrowserClientWindowConverter : JsonConverter<ClientWindow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class BrowserUserContextConverter : JsonConverter<UserContext>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class BrowsingContextConverter : JsonConverter<BrowsingContext>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class ChannelConverter : JsonConverter<Channel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class DateTimeOffsetConverter : JsonConverter<DateTimeOffset>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;

internal class GetClientWindowsResultConverter : JsonConverter<GetClientWindowsResult>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;

internal class GetCookiesResultConverter : JsonConverter<GetCookiesResult>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;

internal class GetRealmsResultConverter : JsonConverter<GetRealmsResult>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;

internal class GetUserContextsResultConverter : JsonConverter<GetUserContextsResult>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;

internal class InputSourceActionsConverter : JsonConverter<SourceActions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Enumerable;

internal class LocateNodesResultConverter : JsonConverter<LocateNodesResult>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class HandleConverter : JsonConverter<Handle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class InputOriginConverter : JsonConverter<Origin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class InterceptConverter : JsonConverter<Intercept>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class InternalIdConverter : JsonConverter<InternalId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class NavigationConverter : JsonConverter<Navigation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Polymorphic;

// https://github.com/dotnet/runtime/issues/72604
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Polymorphic;

// https://github.com/dotnet/runtime/issues/72604
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Polymorphic;

// https://github.com/dotnet/runtime/issues/72604
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Polymorphic;

// https://github.com/dotnet/runtime/issues/72604
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters.Polymorphic;

// https://github.com/dotnet/runtime/issues/72604
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class PreloadScriptConverter : JsonConverter<PreloadScript>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class PrintPageRangeConverter : JsonConverter<PrintPageRange>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class RealmConverter : JsonConverter<Realm>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class RealmTypeConverter : JsonConverter<RealmType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class RequestConverter : JsonConverter<Request>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Json.Converters;

internal class SubscriptionConverter : JsonConverter<Modules.Session.Subscription>
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/webdriver/BiDi/Communication/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

using System.Text.Json;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication;

// https://github.com/dotnet/runtime/issues/72604
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
using System.Threading;
using System;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Transport;

interface ITransport : IDisposable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
using System.Text;
using OpenQA.Selenium.Internal.Logging;

#nullable enable

namespace OpenQA.Selenium.BiDi.Communication.Transport;

class WebSocketTransport(Uri _uri) : ITransport, IDisposable
Expand Down
2 changes: 0 additions & 2 deletions dotnet/src/webdriver/BiDi/EventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
using OpenQA.Selenium.BiDi.Modules.BrowsingContext;
using System.Text.Json.Serialization;

#nullable enable

namespace OpenQA.Selenium.BiDi;

public abstract record EventArgs(BiDi BiDi)
Expand Down
Loading
Loading