Skip to content

Commit

Permalink
Fix incorrectly used named parameters in string formatting in .NET
Browse files Browse the repository at this point in the history
.NET Core does not support named parameters in string.Format(...),
so this commit fixes that. Additionally, this fixes a logic error
in DriverOptions.

Signed-off-by: Jim Evans <[email protected]>
  • Loading branch information
trejjam authored and jimevans committed Jan 10, 2020
1 parent 52b8149 commit 5d02494
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions dotnet/src/webdriver/DevTools/AutoGenerated/DevToolsSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace OpenQA.Selenium.DevTools
using Newtonsoft.Json.Linq;

/// <summary>
/// Represents a WebSocket connection to a running DevTools instance that can be used to send
/// Represents a WebSocket connection to a running DevTools instance that can be used to send
/// commands and recieve events.
///</summary>
public partial class DevToolsSession : IDisposable
Expand Down Expand Up @@ -148,8 +148,8 @@ public string EndpointAddress

await OpenSessionConnection(cancellationToken);

LogTrace("Sending {id} {method}: {params}", message.CommandId, message.CommandName, @params.ToString());
LogTrace("Sending {0} {1}: {2}", message.CommandId, message.CommandName, @params.ToString());

var contents = JsonConvert.SerializeObject(message);
var contentBuffer = Encoding.UTF8.GetBytes(contents);

Expand All @@ -172,7 +172,7 @@ public string EndpointAddress
if (!String.IsNullOrWhiteSpace(errorData))
exceptionMessage = $"{exceptionMessage} - {errorData}";

LogTrace("Recieved Error Response {id}: {message} {data}", modified.CommandId, message, errorData);
LogTrace("Recieved Error Response {0}: {1} {2}", modified.CommandId, message, errorData);
throw new CommandResponseException(exceptionMessage)
{
Code = modified.Result.Value<long>("code")
Expand Down Expand Up @@ -261,7 +261,7 @@ private void ProcessIncomingMessage(string message)
}

commandInfo.Result = messageObject["result"];
LogTrace("Recieved Response {id}: {message}", commandId, commandInfo.Result.ToString());
LogTrace("Recieved Response {0}: {1}", commandId, commandInfo.Result.ToString());
commandInfo.SyncEvent.Set();
return;
}
Expand All @@ -272,12 +272,12 @@ private void ProcessIncomingMessage(string message)
var methodParts = method.Split(new char[] { '.' }, 2);
var eventData = messageObject["params"];

LogTrace("Recieved Event {method}: {params}", method, eventData.ToString());
LogTrace("Recieved Event {0}: {1}", method, eventData.ToString());
OnDevToolsEventReceived(new DevToolsEventReceivedEventArgs(methodParts[0], methodParts[1], eventData));
return;
}

LogTrace("Recieved Other: {message}", message);
LogTrace("Recieved Other: {0}", message);
}

private void OnDevToolsEventReceived(DevToolsEventReceivedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion dotnet/src/webdriver/DriverOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ protected bool IsKnownCapabilityName(string capabilityName)
/// <returns>The name of the type-safe option for the given capability name.</returns>
protected string GetTypeSafeOptionName(string capabilityName)
{
if (this.IsKnownCapabilityName(capabilityName))
if (!this.IsKnownCapabilityName(capabilityName))
{
return string.Empty;
}
Expand Down

0 comments on commit 5d02494

Please sign in to comment.