Method not found: System.Threading.Tasks.Task
rantox
Posts: 8
When I try to deploy a small package I get this error:
I'm running the version 4.5 of the framework.
2013-08-12 15:34:31 INFO Evaluating deployment variables 2013-08-12 15:34:31 INFO Begin deployment 2013-08-12 15:34:31 DEBUG Deploying package Test_DB 1.0.0 to agent http://localhost:10301/ 2013-08-12 15:34:32 ERROR Deployment on the Agent failed. 2013-08-12 15:34:32 INFO Agent output follows: 2013-08-12 15:34:31 DEBUG Begin deployment of package: Test_DB.1.0.0 2013-08-12 15:34:31 DEBUG Deployment Agent information is below: 2013-08-12 15:34:31 DEBUG - Machine name: DEV-01 2013-08-12 15:34:31 DEBUG - Is 64-bit: False 2013-08-12 15:34:31 DEBUG - Service user name: SYSTEM 2013-08-12 15:34:31 DEBUG - CLR version: 4.0.30319.225 2013-08-12 15:34:31 DEBUG - Current directory: C:\Windows\system32 2013-08-12 15:34:31 DEBUG - OS version: Microsoft Windows NT 6.1.7600.0 2013-08-12 15:34:31 DEBUG - Agent version: 2.1.8.8 2013-08-12 15:34:31 DEBUG Installing package Test_DB.1.0.0 from uploaded package cache into C:\ProgramData\Red Gate\DeploymentAgent\Applications\MyDev\Test_DB\1.0.0_2 2013-08-12 15:34:31 INFO Successfully installed 'Test_DB 1.0.0'. 2013-08-12 15:34:31 DEBUG The following variables are available: 2013-08-12 15:34:31 DEBUG - [RedGateEnvironmentName] = 'MyDev' 2013-08-12 15:34:31 DEBUG - [RedGateMachineName] = 'LOCAL' 2013-08-12 15:34:31 DEBUG - [RedGateReleaseNumber] = '1.0.0' 2013-08-12 15:34:31 DEBUG - [RedGatePackageName] = 'Test_DB' 2013-08-12 15:34:31 DEBUG - [RedGatePackageVersion] = '1.0.0' 2013-08-12 15:34:31 DEBUG - [RedGatePackageNameAndVersion] = 'Test_DB.1.0.0' 2013-08-12 15:34:31 DEBUG - [RedGateProjectName] = 'Test_DB' 2013-08-12 15:34:31 DEBUG - [RedGateTaskId] = 'tasks-291' 2013-08-12 15:34:31 DEBUG - [RedGateReleasedBy] = 'administrator' 2013-08-12 15:34:31 DEBUG - [RedGateDeployedBy] = 'administrator' 2013-08-12 15:34:31 DEBUG - [RedGateDeploymentAgentVersion] = '2.1.8.8' 2013-08-12 15:34:31 DEBUG The package has the following requirements: RedGate.Deploy.SqlServerDbPackage.1069b0e8-ff61-414e-95bb-cea5878180d4 2013-08-12 15:34:31 INFO Conventions will be run in the following order: 2013-08-12 15:34:31 INFO - Run PreDeploy.ps1 2013-08-12 15:34:31 INFO - Apply .config transforms 2013-08-12 15:34:31 INFO - Update appSettings/connectionStrings in .config(s) 2013-08-12 15:34:31 INFO - Copy package 2013-08-12 15:34:31 INFO - Database package deployment plugin 2013-08-12 15:34:31 INFO - Run Deploy.ps1 2013-08-12 15:34:31 INFO - Configure IIS 2013-08-12 15:34:31 INFO - Delete package file 2013-08-12 15:34:31 INFO - Run PostDeploy.ps1 2013-08-12 15:34:31 DEBUG Looking for PowerShell scripts named PreDeploy.ps1 2013-08-12 15:34:31 INFO Calling PowerShell script: 'C:\ProgramData\Red Gate\DeploymentAgent\Applications\MyDev\Test_DB\1.0.0_2\RedGate\PreDeploy.ps1' 2013-08-12 15:34:31 DEBUG Script 'C:\ProgramData\Red Gate\DeploymentAgent\Applications\MyDev\Test_DB\1.0.0_2\RedGate\PreDeploy.ps1' completed. 2013-08-12 15:34:31 DEBUG Script output: 2013-08-12 15:34:31 DEBUG Unhandled error: System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<!!0> System.Threading.Tasks.Task.FromResult(!!0)'. at System.Xml.XmlTextReaderImpl..ctor(XmlNameTable nt) at System.Xml.XmlTextReaderImpl..ctor(String url, TextReader input, XmlNameTable nt) at System.Xml.XmlTextReader..ctor(TextReader input) at System.Management.Automation.Runspaces.TypeTable.Initialize(String snapinName, String fileToLoad, Collection`1 errors, AuthorizationManager authorizationManager, PSHost host) at System.Management.Automation.Runspaces.TypeTable.Update(Collection`1 PSSnapinFiles, AuthorizationManager authorizationManager, PSHost host) at System.Management.Automation.Runspaces.RunspaceConfiguration.UpdateTypes() at System.Management.Automation.Runspaces.RunspaceConfiguration.Initialize(ExecutionContext executionContext) at System.Management.Automation.Runspaces.RunspaceConfiguration.Bind(ExecutionContext executionContext) at System.Management.Automation.AutomationEngine..ctor(PSHost hostInterface, RunspaceConfiguration runspaceConfiguration, InitialSessionState iss) at System.Management.Automation.Runspaces.LocalRunspace.DoOpenHelper() at System.Management.Automation.Runspaces.LocalRunspace.OpenHelper(Boolean syncCall) at System.Management.Automation.Runspaces.RunspaceBase.CoreOpen(Boolean syncCall) at System.Management.Automation.Runspaces.RunspaceBase.Open() at RedGate.Deploy.Agent.Deployment.Integration.PowerShell.PowerShellRunner.IsolatedScriptRunner.Execute(PowerShellArguments arguments) 2013-08-12 15:34:31 DEBUG Return code of PowerShell script: -8 2013-08-12 15:34:31 ERROR PowerShell script 'C:\ProgramData\Red Gate\DeploymentAgent\Applications\MyDev\Test_DB\1.0.0_2\RedGate\PreDeploy.ps1' returned non-zero exit code: -8. Deployment terminated.
I'm running the version 4.5 of the framework.
Comments
This isn't something we've seen before. Can I ask you what version of Powershell you have installed on the target machine?
Redgate Software
Major Minor Build Revision
2 0 -1 -1
Microsoft .Net Framework 4.5
Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) Apr 2 2010 15:48:46 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600: ) (Hypervisor)
Can I just check that you've given me the version information from the machine/virtual machine that the Deployment Agent is installed on?
The reason I'm asking this is that the error is occurring while trying to create the Powershell host environment in the Deployment Agent (i.e. on your target machine, not the Deployment Manager server). From the stack trace it looks like there's some sort of mismatch between .Net 4.5 code in the Powershell library (the reference to Task.FromResult, which is a 4.5 specific method) and the framework assemblies loaded into the AppDomain.
Redgate Software