sevaa / tfvcget

A custom release task for TFS/VSTS/Azure DevOps for getting files from source control
2 stars 1 forks source link

Exception calling "Substring" with "1" argument #7

Closed itsho closed 4 years ago

itsho commented 4 years ago

this task worked great up - until recently. For a week or so - I'm randomly getting the following error - on different instances of this task.

this is only one example:

2020-03-11T20:22:52.0118494Z ==============================================================================
2020-03-11T20:22:52.0118925Z Task         : TFVC - Get latest
2020-03-11T20:22:52.0119329Z Description  : Gets a file or a folder tree from TFVC source control
2020-03-11T20:22:52.0119801Z Version      : 1.3.0
2020-03-11T20:22:52.0120147Z Author       : Seva Alekseyev
2020-03-11T20:22:52.0120475Z Help         : 
2020-03-11T20:22:52.0120838Z ==============================================================================
2020-03-11T20:22:52.0132225Z Preparing task execution handler.
2020-03-11T20:22:52.3193028Z Executing the powershell script: Z:\_____\_work\_tasks\TFVCGet_25bd5165-40a2-4ea9-80d6-e47b9ee4550e\1.3.0\TFVCGet.ps1
2020-03-11T20:22:53.0036787Z Creating Z:\_____
2020-03-11T20:22:53.0061712Z Z:\_____
2020-03-11T20:22:53.0204715Z $/_____/_____/_____/_____/_____._____
2020-03-11T20:22:53.0267661Z $/_____/_____/_____/_____/_____-_____._____
2020-03-11T20:22:53.1172805Z ##[error]Microsoft.PowerShell.Commands.WriteErrorException: Exception calling "Substring" with "1" argument(s): "startIndex cannot be larger than length of string.
2020-03-11T20:22:53.1174577Z Parameter name: startIndex"
2020-03-11T20:22:53.1562407Z ##[error]PowerShell script completed with 1 errors.

Thanks in advance

sevaa commented 4 years ago

I have a vague idea what's going on, but I could use some diagnostics. I've made a build with some verbose logging. Can you please install it in your TFS, set a System.Debug variable to true in your pipeline, and run until the issue reproduces? Then post several lines before the exception here. Thank you!

sevaalekseyev.tfvcget-1.3.4.zip

itsho commented 4 years ago
  1. I'll try to get the IT approval to install it.
  2. even after installing it - I'm not sure it will reproduce immediately. I'll let you know if it reproduced.
sevaa commented 4 years ago

If I publish the chatty version in the gallery - will this help?

itsho commented 4 years ago

Yes, it might. in any case - I'll let you know.

Thank you very much! 😃

sevaa commented 4 years ago

Published. Refresh your TFS. Also, you'll need to delete the "TFVC Get" step(s) in the pipeline, save and leave the pipeline, then come back and add the step(s) again. It won't pick up the updated step script otherwise.

Conditional diagnostic logging won't hurt in the long run.

itsho commented 4 years ago

I've refreshed the TFS server and we are using the latest version 1.3.8 will report here if I get the error again.

thank you!

itsho commented 4 years ago

it crashed again. here's the last debug log:

2020-03-17T20:02:19.4827777Z ##[debug]Evaluating condition for step: 'Get 'x' folder from TFS'
2020-03-17T20:02:19.4828746Z ##[debug]Evaluating: succeeded()
2020-03-17T20:02:19.4829050Z ##[debug]Evaluating succeeded:
2020-03-17T20:02:19.4829594Z ##[debug]=> (Boolean) True
2020-03-17T20:02:19.4830049Z ##[debug]Expanded: True
2020-03-17T20:02:19.4830535Z ##[debug]Result: True
2020-03-17T20:02:19.4831072Z ##[section]Starting: Get 'x' folder from TFS
2020-03-17T20:02:19.4835041Z ==============================================================================
2020-03-17T20:02:19.4835366Z Task         : TFVC - Get latest
2020-03-17T20:02:19.4835616Z Description  : Gets a file or a folder tree from TFVC source control
2020-03-17T20:02:19.4835897Z Version      : 1.3.8
2020-03-17T20:02:19.4836153Z Author       : Seva Alekseyev
2020-03-17T20:02:19.4836359Z Help         : 
2020-03-17T20:02:19.4836951Z ==============================================================================
2020-03-17T20:02:19.4904018Z Preparing task execution handler.
2020-03-17T20:02:20.0898415Z Executing the powershell script: E:\Agent1\_work\_tasks\TFVCGet_25bd5165-40a2-4ea9-80d6-e47b9ee4550e\1.3.8\TFVCGet.ps1
2020-03-17T20:02:20.0899582Z ##[debug]PowerShellHandler.Execute - AddCommand(E:\Agent1\_work\_tasks\TFVCGet_25bd5165-40a2-4ea9-80d6-e47b9ee4550e\1.3.8\TFVCGet.ps1)
2020-03-17T20:02:20.0900242Z ##[debug]PowerShellHandler.Execute - Add inputParameters
2020-03-17T20:02:20.0900858Z ##[debug]PowerShellHandler.Execute - AddParameter(TFVCPath=$/aaaaaaaaaaaaaa/bbbbb/cc ddddddd)
2020-03-17T20:02:20.0901501Z ##[debug]PowerShellHandler.Execute - AddParameter(LocalPath=E:\Agent1\_work\437\s\ccddddddd)
2020-03-17T20:02:20.1673891Z ##[debug]PowerShellHandler.Execute - Invoke
2020-03-17T20:02:20.3072719Z ##[debug]Loading module from path 'E:\Agent1\externals\vstshost\Microsoft.TeamFoundation.DistributedTask.Task.LegacySDK.dll'.
2020-03-17T20:02:20.3393926Z ##[debug]Importing cmdlet 'Invoke-ResultPublisher'.
2020-03-17T20:02:20.3394641Z ##[debug]Importing cmdlet 'Publish-TestResults'.
2020-03-17T20:02:20.3395116Z ##[debug]Importing cmdlet 'Add-BuildArtifactLink'.
2020-03-17T20:02:20.3395582Z ##[debug]Importing cmdlet 'Add-BuildAttachment'.
2020-03-17T20:02:20.3396050Z ##[debug]Importing cmdlet 'Convert-String'.
2020-03-17T20:02:20.3396567Z ##[debug]Importing cmdlet 'Copy-BuildArtifact'.
2020-03-17T20:02:20.3397026Z ##[debug]Importing cmdlet 'Get-JavaDevelopmentKitPath'.
2020-03-17T20:02:20.3397481Z ##[debug]Importing cmdlet 'Get-MSBuildLocation'.
2020-03-17T20:02:20.3397919Z ##[debug]Importing cmdlet 'Get-ServiceEndpoint'.
2020-03-17T20:02:20.3398370Z ##[debug]Importing cmdlet 'Get-TaskVariable'.
2020-03-17T20:02:20.3398832Z ##[debug]Importing cmdlet 'Get-TfsClientCredentials'.
2020-03-17T20:02:20.3399298Z ##[debug]Importing cmdlet 'Get-ToolPath'.
2020-03-17T20:02:20.3399756Z ##[debug]Importing cmdlet 'Get-VisualStudioPath'.
2020-03-17T20:02:20.3400249Z ##[debug]Importing cmdlet 'Get-VssConnection'.
2020-03-17T20:02:20.3400741Z ##[debug]Importing cmdlet 'Invoke-Ant'.
2020-03-17T20:02:20.3401193Z ##[debug]Importing cmdlet 'Invoke-BatchScript'.
2020-03-17T20:02:20.3401652Z ##[debug]Importing cmdlet 'Invoke-Maven'.
2020-03-17T20:02:20.3402093Z ##[debug]Importing cmdlet 'Invoke-MSBuild'.
2020-03-17T20:02:20.3402548Z ##[debug]Importing cmdlet 'Invoke-Tool'.
2020-03-17T20:02:20.3403017Z ##[debug]Importing cmdlet 'Invoke-VSTest'.
2020-03-17T20:02:20.3403496Z ##[debug]Importing cmdlet 'Publish-BuildArtifact'.
2020-03-17T20:02:20.3403978Z ##[debug]Importing cmdlet 'Register-XamarinLicense'.
2020-03-17T20:02:20.3404461Z ##[debug]Importing cmdlet 'Unregister-XamarinLicense'.
2020-03-17T20:02:20.3404933Z ##[debug]Importing cmdlet 'Get-X509Certificate'.
2020-03-17T20:02:20.3405402Z ##[debug]Importing cmdlet 'Invoke-DeployTestAgent'.
2020-03-17T20:02:20.3405884Z ##[debug]Importing cmdlet 'Invoke-RunDistributedTests'.
2020-03-17T20:02:20.3406391Z ##[debug]Importing cmdlet 'Invoke-BlockEnvironment'.
2020-03-17T20:02:20.3408779Z ##[debug]Importing cmdlet 'Copy-FilesToAzureBlob'.
2020-03-17T20:02:20.3409248Z ##[debug]Importing cmdlet 'Copy-FilesToTargetMachine'.
2020-03-17T20:02:20.3409734Z ##[debug]Importing cmdlet 'Copy-ToAzureMachines'.
2020-03-17T20:02:20.3410182Z ##[debug]Importing cmdlet 'Remove-Environment'.
2020-03-17T20:02:20.3410671Z ##[debug]Importing cmdlet 'Remove-EnvironmentResources'.
2020-03-17T20:02:20.3411150Z ##[debug]Importing cmdlet 'Complete-EnvironmentOperation'.
2020-03-17T20:02:20.3411684Z ##[debug]Importing cmdlet 'Complete-EnvironmentResourceOperation'.
2020-03-17T20:02:20.3412224Z ##[debug]Importing cmdlet 'Complete-ResourceOperation'.
2020-03-17T20:02:20.3412727Z ##[debug]Importing cmdlet 'Get-Environment'.
2020-03-17T20:02:20.3413203Z ##[debug]Importing cmdlet 'Get-EnvironmentProperty'.
2020-03-17T20:02:20.3413696Z ##[debug]Importing cmdlet 'Get-EnvironmentResources'.
2020-03-17T20:02:20.3414579Z ##[debug]Importing cmdlet 'Get-ExternalIpAddress'.
2020-03-17T20:02:20.3415123Z ##[debug]Importing cmdlet 'Get-ParsedSessionVariables'.
2020-03-17T20:02:20.3415567Z ##[debug]Importing cmdlet 'Get-ProviderData'.
2020-03-17T20:02:20.3416036Z ##[debug]Importing cmdlet 'Invoke-EnvironmentOperation'.
2020-03-17T20:02:20.3416597Z ##[debug]Importing cmdlet 'Invoke-ResourceOperation'.
2020-03-17T20:02:20.3417066Z ##[debug]Importing cmdlet 'Invoke-PsOnRemote'.
2020-03-17T20:02:20.3417610Z ##[debug]Importing cmdlet 'New-OperationLog'.
2020-03-17T20:02:20.3418089Z ##[debug]Importing cmdlet 'Copy-FilesToRemote'.
2020-03-17T20:02:20.3418534Z ##[debug]Importing cmdlet 'Register-Environment'.
2020-03-17T20:02:20.3419010Z ##[debug]Importing cmdlet 'Register-EnvironmentDefinition'.
2020-03-17T20:02:20.3419458Z ##[debug]Importing cmdlet 'Register-Provider'.
2020-03-17T20:02:20.3419892Z ##[debug]Importing cmdlet 'Register-ProviderData'.
2020-03-17T20:02:20.3420293Z ##[debug]Importing cmdlet 'Invoke-UnblockEnvironment'.
2020-03-17T20:02:20.3420830Z ##[debug]Importing cmdlet 'Add-TaskIssue'.
2020-03-17T20:02:20.3421261Z ##[debug]Importing cmdlet 'Complete-Task'.
2020-03-17T20:02:20.3421644Z ##[debug]Importing cmdlet 'Find-Files'.
2020-03-17T20:02:20.3422038Z ##[debug]Importing cmdlet 'Get-LocalizedString'.
2020-03-17T20:02:20.3422496Z ##[debug]Importing cmdlet 'Set-TaskProgress'.
2020-03-17T20:02:20.3423023Z ##[debug]Importing cmdlet 'Set-TaskVariable'.
2020-03-17T20:02:20.3423560Z ##[debug]Importing cmdlet 'Write-TaskDetail'.
2020-03-17T20:02:20.3424098Z ##[debug]Importing cmdlet 'Enable-CodeCoverage'.
2020-03-17T20:02:20.3424614Z ##[debug]Importing cmdlet 'Publish-CodeCoverage'.
2020-03-17T20:02:20.3425127Z ##[debug]Exporting cmdlet 'Add-BuildArtifactLink'.
2020-03-17T20:02:20.3425559Z ##[debug]Exporting cmdlet 'Add-BuildAttachment'.
2020-03-17T20:02:20.3425986Z ##[debug]Exporting cmdlet 'Convert-String'.
2020-03-17T20:02:20.3426411Z ##[debug]Exporting cmdlet 'Copy-BuildArtifact'.
2020-03-17T20:02:20.3426883Z ##[debug]Exporting cmdlet 'Get-JavaDevelopmentKitPath'.
2020-03-17T20:02:20.3427365Z ##[debug]Exporting cmdlet 'Get-MSBuildLocation'.
2020-03-17T20:02:20.3427807Z ##[debug]Exporting cmdlet 'Get-ServiceEndpoint'.
2020-03-17T20:02:20.3428272Z ##[debug]Exporting cmdlet 'Get-TaskVariable'.
2020-03-17T20:02:20.3428772Z ##[debug]Exporting cmdlet 'Get-TfsClientCredentials'.
2020-03-17T20:02:20.3429237Z ##[debug]Exporting cmdlet 'Get-ToolPath'.
2020-03-17T20:02:20.3429689Z ##[debug]Exporting cmdlet 'Get-VisualStudioPath'.
2020-03-17T20:02:20.3430174Z ##[debug]Exporting cmdlet 'Get-VssConnection'.
2020-03-17T20:02:20.3430629Z ##[debug]Exporting cmdlet 'Invoke-Ant'.
2020-03-17T20:02:20.3431071Z ##[debug]Exporting cmdlet 'Invoke-BatchScript'.
2020-03-17T20:02:20.3431502Z ##[debug]Exporting cmdlet 'Invoke-Maven'.
2020-03-17T20:02:20.3431974Z ##[debug]Exporting cmdlet 'Invoke-MSBuild'.
2020-03-17T20:02:20.3432398Z ##[debug]Exporting cmdlet 'Invoke-Tool'.
2020-03-17T20:02:20.3432802Z ##[debug]Exporting cmdlet 'Invoke-VSTest'.
2020-03-17T20:02:20.3434215Z ##[debug]Exporting cmdlet 'Publish-BuildArtifact'.
2020-03-17T20:02:20.3434619Z ##[debug]Exporting cmdlet 'Register-XamarinLicense'.
2020-03-17T20:02:20.3435002Z ##[debug]Exporting cmdlet 'Unregister-XamarinLicense'.
2020-03-17T20:02:20.3435409Z ##[debug]Exporting cmdlet 'Get-X509Certificate'.
2020-03-17T20:02:20.3670839Z ##[debug]Processed: ##vso[task.setprogress value=-1;] 
2020-03-17T20:02:20.3805015Z ##[debug]Invoke - Get-VssConnection cmdlet
2020-03-17T20:02:20.4160779Z ##[debug]Get - SecretService and EndpointService from TaskContext
2020-03-17T20:02:20.4163582Z ##[debug]Fetched Endpoint:SystemVssConnection
2020-03-17T20:02:20.4319807Z ##[debug]AuthorizationType : OAuth
2020-03-17T20:02:20.9851085Z ##[debug]VssConnection created
2020-03-17T20:02:21.3376188Z ##[debug]Adjusted TFSVCPath is $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/ len 34
2020-03-17T20:02:21.3438790Z Creating E:\Agent1\_work\437\s\ccddddddd
2020-03-17T20:02:21.3470068Z E:\Agent1\_work\437\s\ccddddddd
2020-03-17T20:02:21.4485494Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/1.ps1
2020-03-17T20:02:21.4501918Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/2.ps1 base len 34
2020-03-17T20:02:21.4552452Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/2.ps1
2020-03-17T20:02:21.5324254Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/3.ps1 base len 34
2020-03-17T20:02:21.5324661Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/3.ps1
2020-03-17T20:02:21.5425732Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/4.ps1 base len 34
2020-03-17T20:02:21.5426098Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/4.ps1
2020-03-17T20:02:21.5778428Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/5.ps1 base len 34
2020-03-17T20:02:21.5778948Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/5.ps1
2020-03-17T20:02:21.5990097Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/6.ps1 base len 34
2020-03-17T20:02:21.5990645Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/6.ps1
2020-03-17T20:02:21.6127079Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/7.ps1 base len 34
2020-03-17T20:02:21.6127822Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/7.ps1
2020-03-17T20:02:21.6281399Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/8.ps1 base len 34
2020-03-17T20:02:21.6281933Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/8.ps1
2020-03-17T20:02:21.6435752Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/9.ps1 base len 34
2020-03-17T20:02:21.6436269Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/9.ps1
2020-03-17T20:02:21.6573336Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/10.ps1 base len 34
2020-03-17T20:02:21.6574500Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/10.ps1
2020-03-17T20:02:21.6712094Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/11.ps1 base len 34
2020-03-17T20:02:21.6712638Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/11.ps1
2020-03-17T20:02:21.6838346Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/12.ps1 base len 34
2020-03-17T20:02:21.6838914Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/12.ps1
2020-03-17T20:02:21.6953426Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/13.ps1 base len 34
2020-03-17T20:02:21.6954007Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/13.ps1
2020-03-17T20:02:21.7045957Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/14.ps1 base len 34
2020-03-17T20:02:21.7046443Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/14.ps1
2020-03-17T20:02:21.7311705Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/15.ps1 base len 34
2020-03-17T20:02:21.7312140Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/15.ps1
2020-03-17T20:02:21.7512453Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/16.ps1 base len 34
2020-03-17T20:02:21.7513295Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/16.ps1
2020-03-17T20:02:21.7734672Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/17.ps1 base len 34
2020-03-17T20:02:21.7735140Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/17.ps1
2020-03-17T20:02:21.7849728Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/18.ps1 base len 34
2020-03-17T20:02:21.7850227Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/18.ps1
2020-03-17T20:02:21.7994500Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/19.ps1 base len 34
2020-03-17T20:02:21.7995489Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/19.ps1
2020-03-17T20:02:21.8163118Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/20.ps1 base len 34
2020-03-17T20:02:21.8164699Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/20.ps1
2020-03-17T20:02:21.8359285Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/21.ps1 base len 34
2020-03-17T20:02:21.8359696Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/21.ps1
2020-03-17T20:02:21.8504653Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/22.ps1 base len 34
2020-03-17T20:02:21.8505745Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/22.ps1
2020-03-17T20:02:21.8626056Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/23.ps1 base len 34
2020-03-17T20:02:21.8627168Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/23.ps1
2020-03-17T20:02:21.8727915Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/24.ps1 base len 34
2020-03-17T20:02:21.8728415Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/24.ps1
2020-03-17T20:02:21.8919565Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/25.ps1 base len 34
2020-03-17T20:02:21.8920273Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/25.ps1
2020-03-17T20:02:21.9069904Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/26.ps1 base len 34
2020-03-17T20:02:21.9072337Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/26.ps1
2020-03-17T20:02:21.9180130Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/27.ps1 base len 34
2020-03-17T20:02:21.9180571Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/27.ps1
2020-03-17T20:02:21.9327561Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/28.ps1 base len 34
2020-03-17T20:02:21.9328057Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/28.ps1
2020-03-17T20:02:21.9457580Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/29.ps1 base len 34
2020-03-17T20:02:21.9458196Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/29.ps1
2020-03-17T20:02:21.9627663Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/30.ps1 base len 34
2020-03-17T20:02:21.9628409Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/30.ps1
2020-03-17T20:02:21.9772121Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/31.ps1 base len 34
2020-03-17T20:02:21.9772685Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/31.ps1
2020-03-17T20:02:21.9909086Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/32.ps1 base len 34
2020-03-17T20:02:21.9909630Z $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd/32.ps1
2020-03-17T20:02:22.0059562Z ##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd base len 34
2020-03-17T20:02:22.0344417Z ##[error]Microsoft.PowerShell.Commands.WriteErrorException: Exception calling "Substring" with "1" argument(s): "startIndex cannot be larger than length of string.
2020-03-17T20:02:22.0351637Z ##[debug]Processed: ##vso[task.logissue type=error;]Microsoft.PowerShell.Commands.WriteErrorException: Exception calling "Substring" with "1" argument(s): "startIndex cannot be larger than length of string.
2020-03-17T20:02:22.0352845Z Parameter name: startIndex"
2020-03-17T20:02:22.0539605Z ##[error]PowerShell script completed with 1 errors.
2020-03-17T20:02:22.0547358Z ##[section]Finishing: Get 'x' folder from TFS

I suspect that it happens because the last folder name contains a space. but I'm not really sure since it does work most of the time.

thanks in advance.

sevaa commented 4 years ago

Is the path on the third line longer than 34 characters? Those are basically the arguments to substring that is failing.

Also, is the 33th character (0 based) a /?

itsho commented 4 years ago

this is the content of the third line. the path is exactly 34 chars - I've replaced every folder-name & file-name with same number of chars:

##[debug]Need local path of $/aaaaaaaaaaaaaa/bbbbb/cc ddddddd base len 34

regarding your second question - no, it does not end with "/"

sevaa commented 4 years ago

Is the path in question the root of the tree you're trying to get from TFS? In other words, does it match the "Source control path" parameter of the task? Or is it a subfolder somewhere underneath it?

itsho commented 4 years ago

this is the exact value entered to the "Source control path"

sevaa commented 4 years ago

Okay, it's getting clearer now :) Is there a "dequeued" line in the log with that path, by any chance?

itsho commented 4 years ago

Hi.

  1. no - there isn't.
  2. I've edited my previous message to contain the full log.
  3. I have a hunch - can it be because of the TFS Source control path folder is "cc ddddd" while the "ccddddd" (without space)?
sevaa commented 4 years ago

I've edited my previous message to contain the full log.

Thanks for going through that trouble. It helps.

The local path ccddddddd - I assume you've specified it yourself in the "Target path" parameter, without a space. Is that correct?

itsho commented 4 years ago

yes. I did that in the "Target path".

the reason for that is because the path in TFS contains a space and it caused me some issues. so, I figured out I should map it to a space-less folder.

sevaa commented 4 years ago

Okay then, this should be enough for a fix. Hold on, I'll publish an update.

EDIT: figured out exactly what went wrong. I had a check for a similar condition, but not for this.

sevaa commented 4 years ago

Published 1.4.0. Please update your TFS, and let's give it a couple of weeks. If the issue doesn't come back, let's close.

itsho commented 4 years ago

Hat's off to you sir. 😊 I'll let you know if anything changes.