From f35726991eeede7ba6684b304c1674ae9241e1ef Mon Sep 17 00:00:00 2001 From: Michael Render Date: Fri, 7 Mar 2025 23:37:25 -0500 Subject: [PATCH] [dotnet] Remove `#nullable enable` from CDP-generated types --- .../src/generator/Templates/DevToolsSessionDomains.hbs | 5 +---- .../dotnet/devtools/src/generator/Templates/command.hbs | 2 -- .../dotnet/devtools/src/generator/Templates/domain.hbs | 5 +---- .../dotnet/devtools/src/generator/Templates/event.hbs | 2 -- .../dotnet/devtools/src/generator/Templates/type-enum.hbs | 2 -- .../dotnet/devtools/src/generator/Templates/type-hash.hbs | 2 -- .../dotnet/devtools/src/generator/Templates/type-object.hbs | 2 -- 7 files changed, 2 insertions(+), 18 deletions(-) diff --git a/third_party/dotnet/devtools/src/generator/Templates/DevToolsSessionDomains.hbs b/third_party/dotnet/devtools/src/generator/Templates/DevToolsSessionDomains.hbs index fc88ce6ec2241..de2b8fafac118 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/DevToolsSessionDomains.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/DevToolsSessionDomains.hbs @@ -27,10 +27,7 @@ namespace {{rootNamespace}} /// /// Gets the adapter for the {{Name}} domain. /// - public {{dehumanize Name}}.{{dehumanize Name}}Adapter {{dehumanize Name}} - { - get { return m_{{dehumanize Name}}.Value; } - } + public {{dehumanize Name}}.{{dehumanize Name}}Adapter {{dehumanize Name}} => m_{{dehumanize Name}}.Value; {{/each}} /// diff --git a/third_party/dotnet/devtools/src/generator/Templates/command.hbs b/third_party/dotnet/devtools/src/generator/Templates/command.hbs index be3f5f7a4d9ee..2c587ae1eef27 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/command.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/command.hbs @@ -1,7 +1,5 @@ // -#nullable enable - namespace {{rootNamespace}}.{{domain.Name}} { using System.Text.Json.Serialization; diff --git a/third_party/dotnet/devtools/src/generator/Templates/domain.hbs b/third_party/dotnet/devtools/src/generator/Templates/domain.hbs index bb6328b290576..62febcf6798f5 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/domain.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/domain.hbs @@ -1,7 +1,5 @@ // -#nullable enable - namespace {{rootNamespace}}.{{domain.Name}} { using System; @@ -62,9 +60,8 @@ namespace {{rootNamespace}}.{{domain.Name}} { if (e.DomainName == m_domainName) { - if (m_eventMap.ContainsKey(e.EventName)) + if (m_eventMap.TryGetValue(e.EventName, out var eventData)) { - var eventData = m_eventMap[e.EventName]; var eventArgs = e.EventData.Deserialize(eventData.EventArgsType, global::OpenQA.Selenium.DevTools.Json.DevToolsJsonOptions.Default); eventData.EventInvoker(eventArgs); } diff --git a/third_party/dotnet/devtools/src/generator/Templates/event.hbs b/third_party/dotnet/devtools/src/generator/Templates/event.hbs index fb8a6f77a6bfb..846c38e141bd7 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/event.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/event.hbs @@ -1,7 +1,5 @@ // -#nullable enable - namespace {{rootNamespace}}.{{domain.Name}} { using System; diff --git a/third_party/dotnet/devtools/src/generator/Templates/type-enum.hbs b/third_party/dotnet/devtools/src/generator/Templates/type-enum.hbs index 8b6177192c155..408aa792455de 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/type-enum.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/type-enum.hbs @@ -1,7 +1,5 @@ // -#nullable enable - namespace {{rootNamespace}}.{{domain.Name}} { using System.Runtime.Serialization; diff --git a/third_party/dotnet/devtools/src/generator/Templates/type-hash.hbs b/third_party/dotnet/devtools/src/generator/Templates/type-hash.hbs index e6c8ccb12cdc4..9ea606ff3d183 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/type-hash.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/type-hash.hbs @@ -1,7 +1,5 @@ // -#nullable enable - namespace {{rootNamespace}}.{{domain.Name}} { using System.Collections.Generic; diff --git a/third_party/dotnet/devtools/src/generator/Templates/type-object.hbs b/third_party/dotnet/devtools/src/generator/Templates/type-object.hbs index cb1ac03d5085c..5d998b450c1b3 100644 --- a/third_party/dotnet/devtools/src/generator/Templates/type-object.hbs +++ b/third_party/dotnet/devtools/src/generator/Templates/type-object.hbs @@ -1,7 +1,5 @@ // -#nullable enable - namespace {{rootNamespace}}.{{domain.Name}} { using System.Text.Json.Serialization;