37

Closed

Update-Database and Add-Migration commands fail due to package ambiguity

description


UPDATE March-11-2016

I have confirmed that this is fixed in current internal builds of Windows 10 Redstone.

Previous updates:
  • The PowerShell team has checked in a fix that reverts the breaking change that caused this issue. We are waiting for the change to propagate through to the release branch so that we can verify the fix and for it to be included in public Windows Insiders builds. Thanks everyone for reporting this issue and especially for the workarounds provided.
  • We have been able to determine that executing [NuGet.VisualStudio.IVsPackageInstallerServices].AssemblyQualifiedName in the Package Management Console (which is PowerShell console hosted in VS) throws in recent preview builds but used to work in Windows 10 even if there is more than one assembly loaded in memory that implemented the type.

After updating to Windows 10 Enterprise Insider Preview build 11099, I'm now unable to run the 'Update-Database' and 'Add-Migration' commands. I'm using Visual Studio 2015 Update 1 and Entity Framework version 6.1.3.

I don't know how the update and the issue are related, but the commands output the following error:

Type name 'NuGet.VisualStudio.IVsPackageInstallerServices' is ambiguous, it could be 'NuGet.VisualStudio.IVsPackageInstallerServices,
Microsoft.VisualStudio.ApplicationInsights, Version=4.1.60107.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
'NuGet.VisualStudio.IVsPackageInstallerServices, Microsoft.VisualStudio.Web.Application, Version=14.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'.
At C:\Users\Mateus Rodrigues\OneDrive\Developer\Visual Studio\SiCond\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1004 char:5
  • $packageInstallerServices = $componentModel.GetService([NuGet.Vis ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [], RuntimeException
    • FullyQualifiedErrorId : AmbiguousTypeReference
You cannot call a method on a null-valued expression.
At C:\Users\Mateus Rodrigues\OneDrive\Developer\Visual Studio\SiCond\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1006 char:5
  • $vsPackage = $packageInstallerServices.GetInstalledPackages() | ? ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\Mateus Rodrigues\OneDrive\Developer\Visual Studio\SiCond\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:713 char:28
  • $toolsPath = Join-Path $installPath tools
  • ~~~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\Mateus Rodrigues\OneDrive\Developer\Visual Studio\SiCond\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:74
  • ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ...
  • ~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
You cannot call a method on a null-valued expression.
At C:\Users\Mateus Rodrigues\OneDrive\Developer\Visual Studio\SiCond\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 char:5
  • $dispatcher = $utilityAssembly.CreateInstance(
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\Mateus Rodrigues\OneDrive\Developer\Visual Studio\SiCond\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:810 char:20
  • (Join-Path $runner.ToolsPath EntityFramework.PowerShell.dll),
  • ~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
Closed Mar 18, 2016 at 2:02 AM by divega

comments

SanterR wrote Jan 23, 2016 at 6:59 PM

And in Windows 10 Enterprise Insider Preview build 11102

midnait wrote Jan 25, 2016 at 6:49 AM

Same here, Win10 + VS2015 Update 1 + WF 6.1.3

mdrewanz wrote Jan 25, 2016 at 10:40 AM

another one to the list - Win 10 # 11102, VS15 U1 and no EF Package Management commands...

mateusrodrigues wrote Jan 25, 2016 at 1:06 PM

The issue seems to be caused by Windows 10 build 11099 onwards. I now reverted to version 1511 and everything is working fine.

CZEMacLeod wrote Jan 25, 2016 at 2:06 PM

I had to rollback from 11099 to 11082 when I found this issue.

mdrewanz wrote Jan 28, 2016 at 12:19 AM

new build 14251, still the old problem - who will fix this? the EF team or the Windows team?

QuinnDamerell wrote Jan 28, 2016 at 1:05 AM

+1, completely blocked.

sregitz wrote Jan 28, 2016 at 2:03 AM

build 14251 still has this issue. Uninstalled VS2010 items via 2010 uninstaller /full and still having issue.

erossiniuk wrote Jan 28, 2016 at 11:02 AM

Hi all,
I have the same problem with the version 11099.rs1_release.160109-1156

Type name 'Microsoft.VisualStudio.Shell.Package' is ambiguous, it could be 'Microsoft.VisualStudio.Shell.Package, Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or 'Microsoft.VisualStudio.Shell.Package, Microsoft.VisualStudio.Shell.11.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. At C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\MSHGPU2S.W4I\Modules\NuGet\profile.ps1:126 char:5 + $service = [Microsoft.VisualStudio.Shell.Package]::GetGlobalServi ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : AmbiguousTypeReference

Type name 'NuGet.VisualStudio.IVsPackageInstallerServices' is ambiguous, it could be 'NuGet.VisualStudio.IVsPackageInstallerServices, Microsoft.VisualStudio.ApplicationInsights, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or 'NuGet.VisualStudio.IVsPackageInstallerServices, Microsoft.VisualStudio.Web.Application, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. At D:\xxx\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1004 char:5 + $packageInstallerServices = $componentModel.GetService([NuGet.Vis ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [], RuntimeException + FullyQualifiedErrorId : AmbiguousTypeReference

You cannot call a method on a null-valued expression. At D:\xxx\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1006 char:5 + $vsPackage = $packageInstallerServices.GetInstalledPackages() | ? ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull

Join-Path : Cannot bind argument to parameter 'Path' because it is null. At D:\xxx\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:713 char:28 + $toolsPath = Join-Path $installPath tools + ~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

Join-Path : Cannot bind argument to parameter 'Path' because it is null. At D:\xxx\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:74 + ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ... + ~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

You cannot call a method on a null-valued expression. At D:\xxx\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 char:5 + $dispatcher = $utilityAssembly.CreateInstance( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull

Join-Path : Cannot bind argument to parameter 'Path' because it is null. At D:\xxx\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:810 char:20 + (Join-Path $runner.ToolsPath EntityFramework.PowerShell.dll), + ~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

paul_j_melia wrote Jan 28, 2016 at 12:06 PM

Same issue here in 14251.

Resorted to setting up a VM with the last none insider preview release and creating migrations in that ...

Cisien wrote Jan 28, 2016 at 3:10 PM

Has anyone found a workaround to this issue? I'm still hitting it on build 145253

sregitz wrote Jan 28, 2016 at 3:19 PM

Has anyone been able to fix this by uninstalling Visual Studio and simply reinstalling (on 14251) ?
My error shows an ambiguous reference to VS2010 and VS2015. I have done my best, using the VS2010 Uninstall tool cleaner) to remove all 2010 install files without any luck. I've also tried performing a "repair" for VS2015 with no luck.

erossiniuk wrote Jan 28, 2016 at 3:32 PM

Same problem after update for Insider Build 11102.rs1_release.160113-1800

Cisien wrote Jan 28, 2016 at 4:17 PM

I was unable to resolve this issue by reinstalling visual studio. I flattened my machine and reinstalled the latest windows build, along with all of my other tooling yesterday. This issue persisted.

sregitz wrote Jan 28, 2016 at 5:22 PM

Thank you for going the extra mile for the rest of us, Cisien. Will not waste my time doing this now.

sregitz wrote Jan 28, 2016 at 5:25 PM

For reference, since mine is a little different, here is the message I get:


Type name 'Microsoft.VisualStudio.Shell.Package' is ambiguous, it could be
'Microsoft.VisualStudio.Shell.Package, Microsoft.VisualStudio.Shell.14.0,
Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or
'Microsoft.VisualStudio.Shell.Package, Microsoft.VisualStudio.Shell.10.0,
Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
At C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO
14.0\COMMON7\IDE\EXTENSIONS\PPBMHMT1.4I0\Modules\NuGet\profile.ps1:126 char:5
  • $service = [Microsoft.VisualStudio.Shell.Package]::GetGlobalServi ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [], RuntimeException
    • FullyQualifiedErrorId : AmbiguousTypeReference
Type name 'NuGet.VisualStudio.IVsPackageInstallerServices' is ambiguous, it
could be 'NuGet.VisualStudio.IVsPackageInstallerServices,
Xamarin.TestCloud.Integration, Version=4.0.0.1689, Culture=neutral,
PublicKeyToken=0738eb9f132ed756' or
'NuGet.VisualStudio.IVsPackageInstallerServices,
Xamarin.VisualStudio.IOS.Migration.Shell, Version=4.0.0.1689, Culture=neutral,
PublicKeyToken=0738eb9f132ed756'.
At C:\Users\scott\Documents\MyCompany\MyClient\trunk\packages\EntityFramework.6.1.3\to
ols\EntityFramework.psm1:1004 char:5
  • $packageInstallerServices = $componentModel.GetService([NuGet.Vis ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [], RuntimeException
    • FullyQualifiedErrorId : AmbiguousTypeReference
You cannot call a method on a null-valued expression.
At C:\Users\scott\Documents\MyCompany\MyClient\trunk\packages\EntityFramework.6.1.3\to
ols\EntityFramework.psm1:1006 char:5
  • $vsPackage = $packageInstallerServices.GetInstalledPackages() | ? ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\scott\Documents\MyCompany\MyClient\trunk\packages\EntityFramework.6.1.3\to
ols\EntityFramework.psm1:713 char:28
  • $toolsPath = Join-Path $installPath tools
  • ~~~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingVa
      lidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
      icrosoft.PowerShell.Commands.JoinPathCommand
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\scott\Documents\MyCompany\MyClient\trunk\packages\EntityFramework.6.1.3\to
ols\EntityFramework.psm1:780 char:74
  • ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ...
  • ~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingVa
      lidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
      icrosoft.PowerShell.Commands.JoinPathCommand
You cannot call a method on a null-valued expression.
At C:\Users\scott\Documents\MyCompany\MyClient\trunk\packages\EntityFramework.6.1.3\to
ols\EntityFramework.psm1:781 char:5
  • $dispatcher = $utilityAssembly.CreateInstance(
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\scott\Documents\MyCompany\MyClient\trunk\packages\EntityFramework.6.1.3\to
ols\EntityFramework.psm1:810 char:20
  • (Join-Path $runner.ToolsPath EntityFramework.PowerShell.dll),
  • ~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingVa
      lidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,M
      icrosoft.PowerShell.Commands.JoinPathCommand

erossiniuk wrote Jan 29, 2016 at 8:38 AM

Hi guys,
Ive update my PC. Now it's Windows 10 Pro Insider Preview Build 14251.rs1_release.160124-1059. Doesn't work

Yooakim wrote Jan 30, 2016 at 1:47 PM

I have the same issue, I upgraded to Windows 10 Pro Insider Preview build 14251 (160124-1059) and when I try to enable migrations in a ASP.NET Web MVC project the error below occurs. The interesting thing is that if I create a C# Console project, add EntityFramework it works fine. So there seems to be something relating to ASP.NET MVC projects that wreaks havoc with the Enable-Mibrations command. At least that is my experience.

Any thoughts on this?
Package Manager Console Host Version 3.3.0.167

Type 'get-help NuGet' to see all available NuGet commands.

PM> enable-migrations -ContextTypeName RegisterModel
Type name 'NuGet.VisualStudio.IVsPackageInstallerServices' is ambiguous, it could be 'NuGet.VisualStudio.IVsPackageInstallerServices, Microsoft.VisualStudio.ApplicationInsights, Version=4.1.60107.3, Culture=neut
ral, PublicKeyToken=b03f5f7f11d50a3a' or 'NuGet.VisualStudio.IVsPackageInstallerServices, Microsoft.VisualStudio.Web.Application, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1004 char:5
+     $packageInstallerServices = $componentModel.GetService([NuGet.Vis ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [], RuntimeException
    + FullyQualifiedErrorId : AmbiguousTypeReference
 
You cannot call a method on a null-valued expression.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1006 char:5
+     $vsPackage = $packageInstallerServices.GetInstalledPackages() | ? ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:713 char:28
+     $toolsPath = Join-Path $installPath tools
+                            ~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
 
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:74
+ ...  [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ...
+                                                        ~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
 
You cannot call a method on a null-valued expression.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 char:5
+     $dispatcher = $utilityAssembly.CreateInstance(
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:810 char:20
+         (Join-Path $runner.ToolsPath EntityFramework.PowerShell.dll),
+                    ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
 
PM> 

denernun wrote Feb 3, 2016 at 11:27 PM

Here go to Windows 10 Insider Preview 14257 !

mdrewanz wrote Feb 4, 2016 at 12:08 AM

Sorry, new build (14257), same old problems... still not fixed - I wonder who is in charge to fix this.
So far we don't have a clue.

divega wrote Feb 5, 2016 at 1:39 AM

@mdrewanz We have been able to determine that executing [NuGet.VisualStudio.IVsPackageInstallerServices].AssemblyQualifiedName in the Package Management Console (which is PowerShell console hosted in VS) throws in recent preview builds but used to work in Windows 10 even if there is more than one assembly loaded in memory that implemented the type.

We are working with the Windows and the Visual Studio teams to figure out where the regression is.

mdrewanz wrote Feb 5, 2016 at 7:59 AM

Many thanks for the feedback @divega - these are good news, as we have all of you looking at the issue.

cakriwut wrote Feb 8, 2016 at 2:29 PM

Build 14257.rs1_release.160131-1800 still has the problem. Please share any work arround?

vincentw56 wrote Feb 8, 2016 at 3:52 PM

@cakriwut There isn't any work around except going back to a non-insider build. I don't think anyone is looking at the issue. If they were, it would have been fixed by now.

mdrewanz wrote Feb 8, 2016 at 5:50 PM

@cakriwut, @vincentw56 - they are looking at the issue. Look at the update on the top of the issue, it has been provided by @romiller, one of the coordinators of Entity Framework, also, @divega mentioned it on an answer to me, right above.
It seems the issue is a mix between the insider's build and visual studio and they are regression it to find where is the problem.
If you're stuck with this problem, revert to a non-insider's build, but be careful, there is a known issue with build 14257 that not allows you to do it.

RHAD wrote Feb 11, 2016 at 2:05 PM

Is there a workaround available? It's almost a month ago that this issue has been reported.

lorenko wrote Feb 12, 2016 at 12:17 PM

My Azure trial period is ending :((, hope for an other trial, I need migrations ;)

RHAD wrote Feb 13, 2016 at 5:18 AM

I've just installed Visual Studio 2015 update 2 CTP, but the issue is still there.

denernun wrote Feb 13, 2016 at 8:59 AM

It will be the end of the Entity Framework ? It is not possible that there are not enough people to solve such a serious mistake!

StefanCamilleri wrote Feb 14, 2016 at 12:03 AM

I have figured out a workaround for this issue using type aliases. Since it is a bit long, I wrote it in detail in my blog here

RHAD wrote Feb 14, 2016 at 6:29 AM

I can confirm that the workaround proposed by StefanCamilleri is working for me.

Many thanks Stefan, you saved my week!

StefanCamilleri wrote Feb 14, 2016 at 2:02 PM

You're welcome RHAD :)

sregitz wrote Feb 14, 2016 at 2:22 PM

Confirmed that the workaround proposed by StefanCamilleri is working. This seems to be a great temporary solution and perhaps will speed up the discovery of a permanent resolution by the team.

cgithu wrote Feb 15, 2016 at 3:32 AM

Works! Thank you @StefanCamilleri

CZEMacLeod wrote Feb 15, 2016 at 11:22 AM

@StefanCamilleri This is great - my only concern is that the MS teams de-prioritise this now there is a workaround available. Here's hoping they can either build on what you've done or come up with a 'real' solution to the underlying problem/change and that they do it soon.
In the mean time - many thanks as I have been having to try and do EF work on a Hyper-V instance which has not, so far, been very successful.
Cheers, Cynthia

hughjones wrote Feb 17, 2016 at 5:07 PM

After updating to Windows 10 Enterprise Insider Preview build 11099, I'm now unable to run the 'Update-Database' and 'Add-Migration' commands. I'm using Visual Studio 2015 Update 1 and Entity Framework version 6.1.3.

mdrewanz wrote Feb 18, 2016 at 10:12 PM

Ok - we are now at build 14267 and still have the issue...

denernun wrote Feb 19, 2016 at 7:47 AM

and Visual Studio 2015 Update 2 CTP too.....

StefanCamilleri wrote Feb 24, 2016 at 1:36 AM

@CZEMacLeod yeah, I hope so too :( But I did not want to downgrade my setup just because of this, and it was clearly affecting many people.

I totally feel your pain with Hyper-V

divega wrote Feb 24, 2016 at 6:00 AM

Just a quick update on this issue: the error is caused by a change in behavior in a recent build of PowerShell which was included in Windows Insiders builds. We are working with the PowerShell team on a resolution.

buda56 wrote Feb 24, 2016 at 11:29 AM

Hi,
Tried applying the work around described and it still does not work, now get the following output...
Updated the code to the following:
function Get-VSService
{
Param(
    [type]$ServiceType,
    [type]$InterfaceType
)

#$service = [Microsoft.VisualStudio.Shell.Package]::GetGlobalService($ServiceType)
$accel = [psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")
$accel::add(“specificShell”,”Microsoft.VisualStudio.Shell.Package, Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”)
$service = [specificShell]::GetGlobalService($ServiceType)
if ($service -and $InterfaceType) {
    $service = Get-Interface $service $InterfaceType
}

$service
}

Now get the following output:
Package Manager Console Host Version 3.3.0.167

Type 'get-help NuGet' to see all available NuGet commands.

PS C:\Users\Peter\documents\visual studio 2015\Projects\EFTest> enable-migrations
Get-VsComponentModel : The term 'Get-VsComponentModel' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\Peter\documents\visual studio 2015\Projects\EFTest\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1003 char:23
  • $componentModel = Get-VsComponentModel
  • ~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : ObjectNotFound: (Get-VsComponentModel:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException
Type name 'NuGet.VisualStudio.IVsPackageInstallerServices' is ambiguous, it could be 'NuGet.VisualStudio.IVsPackageInstallerServices, Xamarin.TestCloud.Integration, Version=4.0.0.1717, Culture=neutral, PublicKeyToken=0738eb9f132ed756' or
'NuGet.VisualStudio.IVsPackageInstallerServices, Xamarin.VisualStudio.IOS.Migration.Shell, Version=4.0.0.1717, Culture=neutral, PublicKeyToken=0738eb9f132ed756'.
At C:\Users\Peter\documents\visual studio 2015\Projects\EFTest\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1004 char:5
  • $packageInstallerServices = $componentModel.GetService([NuGet.Vis ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [], RuntimeException
    • FullyQualifiedErrorId : AmbiguousTypeReference
You cannot call a method on a null-valued expression.
At C:\Users\Peter\documents\visual studio 2015\Projects\EFTest\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1006 char:5
  • $vsPackage = $packageInstallerServices.GetInstalledPackages() | ? ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\Peter\documents\visual studio 2015\Projects\EFTest\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:713 char:28
  • $toolsPath = Join-Path $installPath tools
  • ~~~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\Peter\documents\visual studio 2015\Projects\EFTest\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:74
  • ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ...
  • ~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
You cannot call a method on a null-valued expression.
At C:\Users\Peter\documents\visual studio 2015\Projects\EFTest\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 char:5
  • $dispatcher = $utilityAssembly.CreateInstance(
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Users\Peter\documents\visual studio 2015\Projects\EFTest\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:810 char:20
  • (Join-Path $runner.ToolsPath EntityFramework.PowerShell.dll),
  • ~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

PS C:\Users\Peter\documents\visual studio 2015\Projects\EFTest>

End Output:
Regards..
Peter

divega wrote Mar 3, 2016 at 8:00 AM

See updated status in the work item's description.

mdrewanz wrote Mar 3, 2016 at 12:16 PM

Great news @divega - we should only wait for a new branch of Windows 10 redstone?
Thank you!

CZEMacLeod wrote Mar 3, 2016 at 3:10 PM

@divega - Excellent. I only hope that the next build of windows 10 also fixes the http.sys / ssl binding issues in the current release that has required me to roll back as IIS Express and IIS no longer work.

divega wrote Mar 3, 2016 at 6:23 PM

@mdrewanz: You need to wait for a new build of Windows 10 redstone that will contain the fix. I used to word branches to refer to the source control branches that each team uses to their work. Changes from the PowerShell team need to be integrated up to a parent branch and the down to the release branch. Then a build from the release branch has to be blessed to be released to Windows Insiders :)

@CZEMacLeod: I don't know anything about the http.sys/ssl binding issue. I hope you have reported it :)

mdrewanz wrote Mar 3, 2016 at 6:56 PM

@divega: Hope this will not take a long time..... ;)

sdorman wrote Mar 3, 2016 at 9:07 PM

The PowerShell team has checked in a fix that reverts the breaking change that caused this issue. We are waiting for the change to propagate through to the release branch so that we can verify the fix and for it to be included in public Windows Insiders builds. Thanks everyone for reporting this issue and especially for the workarounds provided.
@divega Just because the PS team has checked in a fix does not mean this has been resolved because it hasn't been tested/verified by the EF team and included in an insiders build that has actually been deployed to the insiders. Until that happens and we're unblocked by this issue, it's not resolved. I realize this has all happened today, but any updates as to when we might expect this to actually be fixed and available to us?

denernun wrote Mar 4, 2016 at 11:09 PM

The error is still in build 14279 ... and the error bind / IIS ssl also ...

divega wrote Mar 7, 2016 at 2:11 PM

@sdorman I understand it is frustrating to have to wait for the fix. However the flow we use is:
  • When the fix is checked in: move bug to resolved state
  • When the fix is verified: close bug if confirmed resolved, otherwise reactivate if it still repros.
HTH.

bdqlaccp wrote Mar 9, 2016 at 3:36 AM

update windows 10 pro insider preview build 14279 .


Package Manager Console Host Version 3.3.0.167

Type 'get-help NuGet' to see all available NuGet commands.

PM> enable-migrations -ContextTypeName RegisterModel
Type name 'NuGet.VisualStudio.IVsPackageInstallerServices' is ambiguous, it could be 'NuGet.VisualStudio.IVsPackageInstallerServices, Microsoft.VisualStudio.ApplicationInsights, Version=4.1.60107.3, Culture=neut
ral, PublicKeyToken=b03f5f7f11d50a3a' or 'NuGet.VisualStudio.IVsPackageInstallerServices, Microsoft.VisualStudio.Web.Application, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1004 char:5
  • $packageInstallerServices = $componentModel.GetService([NuGet.Vis ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidArgument: (:) [], RuntimeException
    • FullyQualifiedErrorId : AmbiguousTypeReference
You cannot call a method on a null-valued expression.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1006 char:5
  • $vsPackage = $packageInstallerServices.GetInstalledPackages() | ? ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:713 char:28
  • $toolsPath = Join-Path $installPath tools
  • ~~~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:74
  • ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ...
  • ~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
You cannot call a method on a null-valued expression.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 char:5
  • $dispatcher = $utilityAssembly.CreateInstance(
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:\Temp\MRTV.Register\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:810 char:20
  • (Join-Path $runner.ToolsPath EntityFramework.PowerShell.dll),
  • ~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
PM>

divega wrote Mar 11, 2016 at 5:16 PM

New Update posted.

mdrewanz wrote Mar 15, 2016 at 1:54 AM

Thanks @divega, waiting for the next insiders build with fingers crossed that it will have the fix.

One doubt: only EF team uses PowerShell on that way that was broken? No other team from MS uses it on the same way?

divega wrote Mar 16, 2016 at 6:28 PM

One doubt: only EF team uses PowerShell on that way that was broken? No other team from MS uses it on the same way?
That seems to be the case. When I searched a few weeks ago I couldn't find any report of this exception that wasn't related to the EF scripts. That said, while investigating this issue the PowerShell team identified other legitimate scenarios in which the check they had added could cause this same error. In the end they decided it made more sense to keep compatibility.

denernun wrote Mar 18, 2016 at 1:05 AM

All right in build 14291 !!! IIS bind SSL too !!!! Go work !!!!

mdrewanz wrote Mar 18, 2016 at 1:20 AM

@divega, thanks for your effort and patient - build 14291 has the fix and it seems to work fine!

divega wrote Mar 18, 2016 at 2:01 AM

Closing as the fix is now publically available. Thanks everyone for helping.

** Closed by divega 03/17/2016 7:01PM

sdorman wrote Mar 28, 2016 at 5:50 PM

I just upgraded to build 14295, and am still seeing the same issue. Either this didn't get fixed properly or it's a regression.

Cannot convert argument "type", with value: "NuGet.VisualStudio.IVsPackageInstallerServices, Xamarin.TestCloud.Integration,
Version=3.11.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756", for "Add" to type "System.Type": "Cannot convert the
"NuGet.VisualStudio.IVsPackageInstallerServices, Xamarin.TestCloud.Integration, Version=3.11.0.0, Culture=neutral,
PublicKeyToken=0738eb9f132ed756" value of type "System.String" to type "System.Type"."
At D:...\Source\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1005
char:5
  • $accel::add("NuGetInstallerServices","NuGet.VisualStudio.IVsPacka ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [], MethodException
    • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
Unable to find type [NuGetInstallerServices].
At D:...\Source\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1006
char:60
  • ... tallerServices = $componentModel.GetService([NuGetInstallerServices])
  • ~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (NuGetInstallerServices:TypeName) [], RuntimeException
    • FullyQualifiedErrorId : TypeNotFound
You cannot call a method on a null-valued expression.
At D:...\Source\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:1010
char:5
  • $vsPackage = $packageInstallerServices.GetInstalledPackages() | ? ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:...\Source\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:713
char:28
  • $toolsPath = Join-Path $installPath tools
  • ~~~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:...\Source\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:780
char:74
  • ... [System.Reflection.Assembly]::LoadFrom((Join-Path $ToolsPath EntityF ...
  • ~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
You cannot call a method on a null-valued expression.
At D:...\Source\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:781 char:5
  • $dispatcher = $utilityAssembly.CreateInstance(
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At D:...\Source\packages\EntityFramework.6.1.3\tools\EntityFramework.psm1:810
char:20
  • (Join-Path $runner.ToolsPath EntityFramework.PowerShell.dll),
  • ~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand

sdorman wrote Mar 28, 2016 at 5:59 PM

Never mind. I still had part of the workaround in place. Once I removed that, everything seems to be working properly.

divega wrote Mar 28, 2016 at 9:23 PM

Thanks sdorman. Glad to hear it is fixed for you as well.