Open bmanikm opened 6 years ago
@jwittner please take a look at https://github.com/PowerShell/PowerShell-Docs/issues/1200#issue-227526581 for more details on installing from a VSTS feed with PAT. Is this only applicable to PowerShell Core? If it is still reproducible, can you please provide the debug output of Install-Module?
From @jwittner on April 17, 2018 0:5
I had left a small note at the top of my issue, but to clarify this does function in Windows PowerShell, it only fails in Core. I've attached the debug output logs.
@jwittner thanks for the debug log. It looks like this issue is happening in NuGet provider. I am moving this to http://GitHub.com\OneGet\OneGet repo.
InstallPackage' - name='build', version='3.2.4888',destination='C:\Users\jowitt\AppData\Local\Temp\1726031933'
DownloadPackage' - name='build', version='3.2.4888',destination='C:\Users\jowitt\AppData\Local\Temp\1726031933\build\build.nupkg', uri='https://wwhs.pkgs.visualstudio.com/_packaging/wwhs.powershell/nuget/v2?id=build&version=3.2.4888'
Downloading 'https://wwhs.pkgs.visualstudio.com/_packaging/wwhs.powershell/nuget/v2?id=build&version=3.2.4888'.
Object reference not set to an instance of an object.
00:00:06.3406939 at System.Net.Http.WinHttpAuthHelper.SaveServerCredentialsToCache(Uri uri, UInt32 authScheme, ICredentials serverCredentials)
at System.Net.Http.WinHttpAuthHelper.CheckResponseForAuthentication(WinHttpRequestState state, UInt32& proxyAuthScheme, UInt32& serverAuthScheme)
at System.Net.Http.WinHttpHandler.<StartRequest>d__105.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Net.Http.HttpClient.<FinishSendAsyncUnbuffered>d__59.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PackageManagement.NuGetProvider.NuGetClient.<DownloadDataToFileAsync>d__15.MoveNext()
Unrelated project, but, we've just debugged the same NullReferenceException
in our own NuGet v3 client (also triggered by VSTS/PATs, and crashing on the same line).
We inspected the corefx code (WinHttpAuthHelper
) but couldn't spot anything obviously to blame.
In the end, we worked around it by setting PreAuthenticate = false
on our HttpClientHandler
- we can now install packages from VSTS feeds using PATs 🎉
Not sure if the same thing will work here, but might be worth investigating. HTH!
From @jwittner on April 12, 2018 21:37
Note: The same commands succeed in Windows Powershell.
Steps to reproduce
Expected behavior
Actual behavior
Environment data
Copied from original issue: PowerShell/PowerShellGet#261