GitTools / GitLink

Making .NET open source accessible!
MIT License
554 stars 86 forks source link

Source download from Visual Studio fails on server accepting TLS>1.0 connections only #200

Closed Ilod closed 6 years ago

Ilod commented 6 years ago

Steps to reproduce

  1. Index a pdb with Powershell and a https url
  2. Configure the web server to reject SSL3 and TLS1.0 connections
  3. Attempt to access the source file when debugging in Visual Studio

Platform: Windows 10, Visual Studio 2017

Expected behaviour

The source file should be downloaded and opened by Visual Studio.

Actual behaviour

The file fails to download. When enabling "Print source server diagnostic messages...", the following log is visible (urls removed):

powershell invoke-command -scriptblock {$webClient = New-Object System.Net.WebClient; $webClient.UseDefaultCredentials = $true; $webClient.DownloadFile('[...], '[...]');}
Exception calling "DownloadFile" with "2" argument(s): "The underlying connection was closed: An unexpected error
occurred on a send."
At line:1 char:182
+ ... ls = $true; $webClient.DownloadFile('[...] ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebException

Comments

This is caused by Visual Studio opening a powershell instance with some strange context when downloading files from source server (probably for legacy reasons). System.Net.ServicePointManager.SecurityProtocol is set to only accept Ssl3 and Tls (meaning Tls 1.0)

GeertvanHorrik commented 6 years ago

Thanks for your contribution. Deployed an alpha to both nuget & chocolatye