When I run Add-Migration using Microsoft.EntityFrameworkCore.Tools 1.1.1, I get the following error:
Add-Migration : Exception calling "Substring" with "1" argument(s):
"StartIndex cannot be less than zero. Parameter name: startIndex" At
line:1 char:1
+ Add-Migration
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Migration], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException,Add-Migration
The same stuff works perfect with version 1.1.0-preview4-final
This is issue #8163. You can safely ignore the error. It will be fixed in 2.0.0-preview2-final.
Related
I my trying to connect to a client SFTP server from our Windows Server to pull the files. The connection works fine when trying from my Local machine both using WinSCP application and PowerShell script. But I have to add proxy setting while I am trying to connect from the server which is not the case in Local connection.
While in the server I am able to connect from WinSCP application by enabling proxy setting but fails when I am trying to connect using PowerShell script. I got the custom generated PowerShell script from WinSCP connection.
Below is the code snippet and corresponding error message.
$sessionOptions = New-Object WinSCP.SessionOptions -Property #{
Protocol = [WinSCP.Protocol]::SFTP
HostName = "<host name>"
PortNumber = 22
UserName = "<Username>"
SshPrivateKeyPath= "<private key>"
SshHostKeyFingerprint = "<SshHostKeyFingerprint>"
}
$sessionOptions.AddRawSettings("ProxyMethod", "3")
$sessionOptions.AddRawSettings("ProxyHost", "<proxyhost>")
$sessionOptions.AddRawSettings("ProxyPort", "3128")
$sessionOptions.AddRawSettings("ProxyLocalhost", "1")
getting below error message.
New-Object : The value supplied is not valid, or the property is read-only. Change the value, and then try again.
At line:3 char:19
+ $sessionOptions = New-Object WinSCP.SessionOptions -Property #{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [New-Object], Exception
+ FullyQualifiedErrorId : SetValueException,Microsoft.PowerShell.Commands.NewObjectCommand
You cannot call a method on a null-valued expression.
At line:12 char:1
+ $sessionOptions.AddRawSettings("ProxyMethod", "3")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:13 char:1
+ $sessionOptions.AddRawSettings("ProxyHost", "<proxyhost>")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:14 char:1
+ $sessionOptions.AddRawSettings("ProxyPort", "3128")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At line:15 char:1
+ $sessionOptions.AddRawSettings("ProxyLocalhost", "1")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
The most probable explanation is that the value of SessionOptions.SshHostKeyFingerprint is invalid, no other property in your code is validated.
See also WinSCP .NET assembly in PowerShell - Creating SessionOptions - The value supplied is not valid, or the property is read-only
As your fingerprint format seems correct, but as it is a "modern" ssh-ed25519 key, I assume that you have an old version of WinSCP .NET assembly that does not accept this key. You have probably used newer version of WinSCP (the GUI) to obtain this key, but your version of .NET assembly does not accept it. Make sure you use the latest version of the assembly.
I installed Golem v 2.2 into my project "Jupiter.Gole.ISM" by entering this command at the Package Manager Console.
PM> Install-Package Golem
Even though the system reported that Golem 2.2.1 was successfully installed to my project, two errors had appeared:
1) Value does not fall within the expected range.
2) You cannot call a method on a null-valued expression.
...
...
Executing script file 'C:\Users\AChan\Documents\TestFrameworks\Jupiter.Gole.ISM\packages\Golem.2.2.1\tools\install.ps1'
InstallPath: C:\Users\AChan\Documents\TestFrameworks\Jupiter.Gole.ISM\packages\Golem.2.2.1
ToolsPath: C:\Users\AChan\Documents\TestFrameworks\Jupiter.Gole.ISM\packages\Golem.2.2.1\tools
Package: NuGet.PackageManagement.VisualStudio.ScriptPackage
Project: System.__ComObject
Value does not fall within the expected range.
At C:\Users\AChan\Documents\TestFrameworks\Jupiter.Gole.ISM\packages\Golem.2.2.1\tools\install.ps1:32 char:1
+ $mobFile = $project.ProjectItems.Item("Proxy").ProjectItems.Item("bro ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException
You cannot call a method on a null-valued expression.
At C:\Users\AChan\Documents\TestFrameworks\Jupiter.Gole.ISM\packages\Golem.2.2.1\tools\install.ps1:33 char:1
+ $mobFile.Properties.Item("CopyToOutputDirectory").Value = 2
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Successfully installed 'Golem 2.2.1' to Jupiter.Gole.ISM
PM>
Thanks for your feedback.
Arlene
Whenever I open the package manager console in new VS 2017 session, it shows the below two error messages, and the for all intents and purposes operates normally. At least for vanilla commands like Install-Package.
Join-Path : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'ChildPath'. Specified method is not supported.
At C:\Dev\.NET\Projects\AcmeSoft\Code\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\init.ps1:13 char:57
+ ... rPackageDirectory = Join-Path $packageDirectory $compilerPackage.Name
+ ~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Join-Path], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.PowerShell.Commands.JoinPathCommand
and
Join-Path : Cannot bind argument to parameter 'Path' because it is null.
At C:\Dev\.NET\Projects\AcmeSoft\Code\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\init.ps1:14 char:44
+ ... erPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Join-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.JoinPathCommand
The offending line for the first is:
$compilerPackageDirectory = Join-Path $packageDirectory $compilerPackage.Name
with the error at $compilerPackage.Name (i.e. "char:57")
The offending line for the second is:
$compilerPackageToolsDirectory = Join-Path $compilerPackageDirectory 'tools'
with the error at $compilerPackageDirectory 'tools'.
Can anyone with more Nuget and or PowerShell skills than me explain why this is happening, and how I can fix it, please?
I got below error while running Enable-Migrations on my ASP.NET MVC5 project (Powershell v5 & Visual Studio 2015). I have tried to uninstall and re-install EntityFramework (v6.1.3) but no lucky.
Does anyone know how to solve it?
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
This is a known bug if you have any of the Windows 10 Insider Preview builds from 11099 to 14257
Official bug report https://entityframework.codeplex.com/workitem/2872
After updating NuGet to version 2.8.50313.31, opening the Package Manager Console displays a number of errors.
Is this a known issue with that (now current) version? Is there a fix/work-around?
If there is no fix, how does one revert to the previous version of NuGet?
New-Object : Could not load file or assembly
'System.Management.Automation, Ver sion=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its d ependencies. The
system cannot find the file specified. At
E:\dev\myProject\packages\MvcScaffolding.1.0.6\tools\registerWithMvcTooling.ps1
:143 char:27
+ $newProvider = New-Object <<<< $powerShellScaffolderProviderType($mvcSca ffoldingProvider)
+ CategoryInfo : NotSpecified: (:) [New-Object], FileNotFoundExce ption
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerS
hell.Commands.NewObjectCommand Cannot convert argument "0", with
value: "Microsoft.VisualStudio.Web.Mvc.Scaffo
lding.PowerShell.PowerShellScaffolderProvider", for "Add" to type
"Microsoft.Vi
sualStudio.Web.Mvc.Extensibility.Scaffolding.ScaffolderProvider":
"Cannot conve rt the
"Microsoft.VisualStudio.Web.Mvc.Scaffolding.PowerShell.PowerShellScaffol
derProvider" value of type
"Microsoft.VisualStudio.Web.Mvc.Scaffolding.PowerShe
ll.PowerShellScaffolderProvider" to type
"Microsoft.VisualStudio.Web.Mvc.Extens
ibility.Scaffolding.ScaffolderProvider"." At
E:\dev\myProject\packages\MvcScaffolding.1.0.6\tools\registerWithMvcTooling.ps1
:144 char:19
+ $allProviders.Add <<<< ($newProvider) | Out-Null
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument PM> New-Object : Could
not load file or assembly 'System.Management.Automation, Ver
sion=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one
of its d ependencies. The system cannot find the file specified. At
E:\dev\myProject\packages\MvcScaffolding.1.0.6\tools\registerWithMvcTooling.ps1
:143 char:27
+ $newProvider = New-Object <<<< $powerShellScaffolderProviderType($mvcSca ffoldingProvider)
+ CategoryInfo : NotSpecified: (:) [New-Object], FileNotFoundExce ption
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerS
hell.Commands.NewObjectCommand Cannot convert argument "0", with
value: "Microsoft.VisualStudio.Web.Mvc.Scaffo
lding.PowerShell.PowerShellScaffolderProvider", for "Add" to type
"Microsoft.Vi
sualStudio.Web.Mvc.Extensibility.Scaffolding.ScaffolderProvider":
"Cannot conve rt the
"Microsoft.VisualStudio.Web.Mvc.Scaffolding.PowerShell.PowerShellScaffol
derProvider" value of type
"Microsoft.VisualStudio.Web.Mvc.Scaffolding.PowerShe
ll.PowerShellScaffolderProvider" to type
"Microsoft.VisualStudio.Web.Mvc.Extens
ibility.Scaffolding.ScaffolderProvider"." At
E:\dev\myProject\packages\MvcScaffolding.1.0.6\tools\registerWithMvcTooling.ps1
:144 char:19
+ $allProviders.Add <<<< ($newProvider) | Out-Null
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument New-Object : Could not
load file or assembly 'System.Management.Automation, Ver sion=3.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its d
ependencies. The system cannot find the file specified. At
E:\dev\myProject\packages\MvcScaffolding.1.0.6\tools\registerWithMvcTooling.ps1
:143 char:27
+ $newProvider = New-Object <<<< $powerShellScaffolderProviderType($mvcSca ffoldingProvider)
+ CategoryInfo : NotSpecified: (:) [New-Object], FileNotFoundExce ption
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerS
hell.Commands.NewObjectCommand Cannot convert argument "0", with
value: "Microsoft.VisualStudio.Web.Mvc.Scaffo
lding.PowerShell.PowerShellScaffolderProvider", for "Add" to type
"Microsoft.Vi
sualStudio.Web.Mvc.Extensibility.Scaffolding.ScaffolderProvider":
"Cannot conve rt the
"Microsoft.VisualStudio.Web.Mvc.Scaffolding.PowerShell.PowerShellScaffol
derProvider" value of type
"Microsoft.VisualStudio.Web.Mvc.Scaffolding.PowerShe
ll.PowerShellScaffolderProvider" to type
"Microsoft.VisualStudio.Web.Mvc.Extens
ibility.Scaffolding.ScaffolderProvider"." At
E:\dev\myProject\packages\MvcScaffolding.1.0.6\tools\registerWithMvcTooling.ps1
:144 char:19
+ $allProviders.Add <<<< ($newProvider) | Out-Null
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
It turns out that MvcScaffolding.1.0.6 is no longer referenced by any project in the solution.
Removing it from the NuGet command line
Uninstall-Package MvcScaffolding
resolved the issue.
There is currently version 1.0.9 of MvcScaffolding. The issue may be resolved in that version. However, since I no longer reference that package, I did not test that.