-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Blockedblocked on something external to this repoblocked on something external to this repoResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues
Milestone
Description
This is a regression introduced by .NET Core 1.1 preview release libraries. It also happens on alpha.12 release.
Steps to reproduce
$RequiredAssembliesForInternalWebProxy = @( [System.Net.IWebProxy].Assembly.FullName,
[System.Uri].Assembly.FullName )
$SourceForInternalWebProxy = @"
using System;
using System.Net;
namespace Microsoft.PowerShell.Commands.PowerShellGet
{
/// <summary>
/// Used by Ping-Endpoint function to supply webproxy to HttpClient
/// We cannot use System.Net.WebProxy because this is not available on CoreClr
/// </summary>
public class InternalWebProxy : IWebProxy
{
Uri _proxyUri;
ICredentials _credentials;
public InternalWebProxy(Uri uri, ICredentials credentials)
{
Credentials = credentials;
_proxyUri = uri;
}
/// <summary>
/// Credentials used by WebProxy
/// </summary>
public ICredentials Credentials
{
get
{
return _credentials;
}
set
{
_credentials = value;
}
}
public Uri GetProxy(Uri destination)
{
return _proxyUri;
}
public bool IsBypassed(Uri host)
{
return false;
}
}
}
"@
Add-Type -ReferencedAssemblies $RequiredAssembliesForInternalWebProxy `
-TypeDefinition $SourceForInternalWebProxy `
-Language CSharp `
-ErrorAction SilentlyContinueExpected behavior
Succeeds
Actual behavior
Add-Type : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more
information.
At line:1 char:1
+ Add-Type -ReferencedAssemblies $RequiredAssembliesForInternalWebProxy ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Type], ReflectionTypeLoadException
+ FullyQualifiedErrorId : System.Reflection.ReflectionTypeLoadException,Microsoft.PowerShell.Commands.AddTypeCommand
PS D:\>
PS D:\> $Error[0].Exception.LoaderExceptions
Method 'GetProxy' in type 'Microsoft.PowerShell.Commands.PowerShellGet.InternalWebProxy' from assembly 'nxg304ea.wnz,
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.Environment data
> $PSVersionTable
Name Value
---- -----
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSVersion 6.0.0-alpha
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
GitCommitId v6.0.0-alpha.12-104-g67e9bf6376b90c289d725c904280a2439de4dd3b
PSEdition Core
BuildVersion 3.0.0.0
CLRVersion
SerializationVersion 1.1.0.1Metadata
Metadata
Assignees
Labels
Blockedblocked on something external to this repoblocked on something external to this repoResolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdletsgeneral cmdlet issuesgeneral cmdlet issues