Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ public static void ApplySettingsFromConnectionString(this RabbitMQTransport tran
transport.ValidateRemoteCertificate = !disableRemoteCertificateValidation;
}

if (dictionary.TryGetValue("UseExternalAuthMechanism", out var useExternalAuthMechanismString))
if (dictionary.TryGetValue("UseExternalAuthMechanism", out var useExternalAuthMechanismString) && bool.TryParse(useExternalAuthMechanismString, out var useExternalAuthMechanism) && useExternalAuthMechanism)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If parsing fails, there should be an exception as that means there was a typo unless the values in the dictionary have already been format validated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the code uses TryParse too. I'm trying to make a minimal fix here.

{
_ = bool.TryParse(useExternalAuthMechanismString, out var useExternalAuthMechanism);
transport.AuthMechanisms = [new ExternalMechanismFactory()];
}
}
Expand Down