Troubleshoot SSL/TLS errors by disabling .NET troubleshooting tools

Logging is the immense tool for troubleshooting of .NET apps, especially when it comes to debugging network-related code. However, it turns out that sometimes these troubleshooting tools can be the root of the problem!

A client reported that they experience the strange [NotSupportedException: The certificate key algorithm is not supported.] exception when connecting to GMail’s IMAP over SSL with our MailBee.NET Objects email library. First thought was that TLS 1.2 was not in place (it’s required by Google) but further testing showed that this wasn’t true.

With extra research, we found that the client’s app had System.Diagnostics logging enabled for network connections. Normally tracing network connections with System.Diagnostics helps detect and eliminate various network issues but this time it caused the issue itself. Removing <system.diagnostics> section from app.config or web.config fixed this error.

Troubleshoot SSL/TLS errors by disabling .NET troubleshooting tools