jabbera / my-vsts-tasks

20 stars 18 forks source link

System.Exception: Method invocation failed because [System.String[]] doesn't contain a method named 'Trim'. #31

Closed screaney closed 6 years ago

screaney commented 6 years ago

On several of my deployment machines, the Stop Service task will fail with: System.Exception: Method invocation failed because [System.String[]] doesn't contain a method named 'Trim'.

All my deployment environments are Windows Server 2008 R2. Is there something specific that needs to be configured on the target-side to ensure this works? My environments were setup at different times, so they may have some configuration differences.

Log (with redactions for security)

2018-03-13T17:34:16.7467795Z StartStopServices -serviceNames "SERVICENAME" -instanceName "" -startupType Automatic -waitTimeoutInSeconds 120 -killIfTimedOut false 2018-03-13T17:34:16.9464933Z Performing deployment in parallel on all the machines. 2018-03-13T17:34:16.9568575Z Deployment started for machine: SERVERNAME with port 5985. 2018-03-13T17:34:38.1161361Z Deployment status for machine SERVERNAME : Failed 2018-03-13T17:34:38.1369454Z Deployment failed on machine SERVERNAME with following message : System.Exception: Method invocation failed because [System.String[]] doesn't contain a method named 'Trim'. 2018-03-13T17:34:38.1662852Z ##[error]] doesn't contain a method named 'Trim'."}};] 2018-03-13T17:34:38.4402777Z ##[error]Deployment on one or more machines failed. System.Exception: Method invocation failed because [System.String[]] doesn't contain a method named 'Trim'. Error returned from remote deployment. 2018-03-13T17:34:38.5057775Z ##[section]Finishing: Stop Service

screaney commented 6 years ago

You can disregard this issue, the culprit is the target machine only has PS 2.0, the one's that work have PS 3.0. I would recommend putting somewhere that you require >= PS 3.0 on the target machine.

jabbera commented 6 years ago

Yeah. You are not the only person to be but by this. I really should sort it.