Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dotnet/src/webdriver/Chromium/ChromiumDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ public DevToolsSession GetDevToolsSession(int devToolsProtocolVersion)
/// <summary>
/// Closes a DevTools session.
/// </summary>
[RequiresUnreferencedCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
[RequiresDynamicCode(DevToolsSession.CDP_AOTIncompatibilityMessage)]
public void CloseDevToolsSession()
{
if (this.devToolsSession != null)
Expand Down
16 changes: 9 additions & 7 deletions dotnet/src/webdriver/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ public class Command
{
private readonly static JsonSerializerOptions s_jsonSerializerOptions = new()
{
TypeInfoResolver = JsonTypeInfoResolver.Combine(CommandJsonSerializerContext.Default, new DefaultJsonTypeInfoResolver()),
TypeInfoResolverChain =
{
CommandJsonSerializerContext.Default,
new DefaultJsonTypeInfoResolver()
},
Converters = { new ResponseValueJsonConverter() }
};

Expand Down Expand Up @@ -86,17 +90,14 @@ public string ParametersAsJsonString
{
get
{
string parametersString;
if (this.Parameters != null && this.Parameters.Count > 0)
{
parametersString = JsonSerializer.Serialize(this.Parameters, s_jsonSerializerOptions);
return JsonSerializer.Serialize(this.Parameters, s_jsonSerializerOptions);
}
else
{
parametersString = "{}";
return "{}";
}

return parametersString;
}
}

Expand All @@ -118,7 +119,7 @@ public override string ToString()
/// <exception cref="ArgumentNullException">If <paramref name="value"/> is <see langword="null"/>.</exception>
private static Dictionary<string, object?>? ConvertParametersFromJson(string value)
{
Dictionary<string, object?>? parameters = JsonSerializer.Deserialize<Dictionary<string, object?>>(value, s_jsonSerializerOptions);
Dictionary<string, object?>? parameters = JsonSerializer.Deserialize<Dictionary<string, object?>>(value, CommandJsonSerializerContext.Default.DictionaryStringObject!);
return parameters;
}
}
Expand Down Expand Up @@ -167,5 +168,6 @@ public override string ToString()
[JsonSerializable(typeof(Dictionary<string, short>))]
[JsonSerializable(typeof(Dictionary<string, ushort>))]
[JsonSerializable(typeof(Dictionary<string, string>))]
[JsonSourceGenerationOptions(Converters = [typeof(ResponseValueJsonConverter)])]
internal partial class CommandJsonSerializerContext : JsonSerializerContext;
}
5 changes: 3 additions & 2 deletions dotnet/src/webdriver/Internal/FileUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,10 @@ public static string GetCurrentDirectory()
string? location = null;

// Make sure not to call Path.GetDirectoryName if assembly location is null or empty
if (!string.IsNullOrEmpty(executingAssembly.Location))
string assemblyLocation = executingAssembly.Location;
if (!string.IsNullOrEmpty(assemblyLocation))
{
location = Path.GetDirectoryName(executingAssembly.Location);
location = Path.GetDirectoryName(assemblyLocation);
}

if (string.IsNullOrEmpty(location))
Expand Down
Loading