Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StackoverflowException #6

Closed
tbolon opened this issue Jul 24, 2017 · 5 comments
Closed

StackoverflowException #6

tbolon opened this issue Jul 24, 2017 · 5 comments

Comments

@tbolon
Copy link
Contributor

tbolon commented Jul 24, 2017

Even with the new 1.3.6 version released, I still receive an error on certain cases.

******************************************************************************
Starting: WorkItem Updater
******************************************************************************
==============================================================================
Task         : WorkItem Updater
Description  : This task allows to update WorkItems linked to the build.
Version      : 1.3.6
Author       : Blue Basher
Help         : 
==============================================================================
VstsTaskSdk 0.8.1 commit 
Importing function 'Assert-Path'.
Importing function 'Find-Files'.
Importing function 'Find-Match'.
Importing function 'Get-AssemblyReference'.
Importing function 'Get-Endpoint'.
Importing function 'Get-Input'.
Importing function 'Get-LocString'.
Importing function 'Get-TaskVariable'.
Importing function 'Get-TaskVariableInfo'.
Importing function 'Get-TfsClientCredentials'.
Importing function 'Get-TfsService'.
Importing function 'Get-VssCredentials'.
Importing function 'Get-VssHttpClient'.
Importing function 'Import-LocStrings'.
Importing function 'Invoke-Tool'.
Importing function 'New-FindOptions'.
Importing function 'New-MatchOptions'.
Importing function 'Out-Default'.
Importing function 'Select-Match'.
Importing function 'Set-TaskVariable'.
Importing function 'Trace-EnteringInvocation'.
Importing function 'Trace-LeavingInvocation'.
Importing function 'Trace-Path'.
Importing function 'Write-AddAttachment'.
Importing function 'Write-AddBuildTag'.
Importing function 'Write-AssociateArtifact'.
Importing function 'Write-LogDetail'.
Importing function 'Write-SetProgress'.
Importing function 'Write-SetResult'.
Importing function 'Write-SetSecret'.
Importing function 'Write-SetVariable'.
Importing function 'Write-TaskDebug'.
Importing function 'Write-TaskError'.
Importing function 'Write-TaskVerbose'.
Importing function 'Write-TaskWarning'.
Importing function 'Write-UpdateBuildNumber'.
Importing function 'Write-UploadArtifact'.
Importing function 'Write-UploadBuildLog'.
Entering D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\task.ps1.
BUILD_BUILDID: '48676'
SYSTEM_TEAMPROJECTID: 'fb077072-07fd-4ba0-bd11-2753fc89f3af'
BUILD_REQUESTEDFOR: '[redacted]'
INPUT_WORKITEMTYPE: 'Product Backlog Item'
INPUT_WORKITEMSTATE: 'Done'
INPUT_WORKITEMKANBANSTATE (empty)
INPUT_WORKITEMDONE: 'false'
Converted to bool: False
INPUT_LINKBUILD: 'true'
Converted to bool: True
INPUT_UPDATEASSIGNEDTO: 'Never'
BuildId 48676
ProjectId fb077072-07fd-4ba0-bd11-2753fc89f3af
requestedFor [redacted]
workItemType Product Backlog Item
WorkItemState Done
WorkItemKanbanState 
WorkItemDone False
updateAssignedTo Never
Converting buildId '48676' as int
Converting projectId 'fb077072-07fd-4ba0-bd11-2753fc89f3af' as GUID
Entering Get-VssHttpClient.
TypeName: 'Microsoft.TeamFoundation.WorkItemTracking.WebApi.WorkItemTrackingHttpClient'
SYSTEM_TEAMFOUNDATIONCOLLECTIONURI: 'http://[redacted]:8080/tfs/DefaultCollection/'
Entering Get-VssCredentials.
OMDirectory: ''
ENDPOINT_URL_SystemVssConnection: 'http://[redacted]:8080/tfs/DefaultCollection/'
ENDPOINT_AUTH_SystemVssConnection: '********'
ENDPOINT_DATA_SystemVssConnection (empty)
Entering Get-OMType.
TypeName: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
OMKind: 'WebApi'
OMDirectory: ''
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.OAuth.WebApi.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.OAuth.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.WebApi.dll'
Loading assembly: D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.WebApi.dll
Resolving 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
Resolving 'System.Net.Http.Formatting, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.dll'
Not found.
Leaving Get-OMType.
Entering Get-OMType.
TypeName: 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential'
OMKind: 'WebApi'
OMDirectory: ''
Require: 'True'
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.Client.WebApi.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.Client.dll'
Loading assembly: D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.Client.dll
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
LoaderExceptions[0]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[1]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ServiceBus, Version=2.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[2]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[3]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[4]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[5]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[6]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
LoaderExceptions[7]: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=2.16.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential'
The type was loaded successfully.
Leaving Get-OMType.
Leaving Get-VssCredentials.
Entering Get-OMType.
TypeName: 'Microsoft.TeamFoundation.WorkItemTracking.WebApi.WorkItemTrackingHttpClient'
OMKind: 'WebApi'
OMDirectory: ''
Require: 'True'
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.TeamFoundation.WorkItemTracking.WebApi.WorkItemTrackingHttpClient'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.WorkItemTracking.WebApi.WebApi.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.WorkItemTracking.WebApi.dll'
Loading assembly: D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.WorkItemTracking.WebApi.dll
Testing whether type can be loaded: 'Microsoft.TeamFoundation.WorkItemTracking.WebApi.WorkItemTrackingHttpClient'
The type was loaded successfully.
Leaving Get-OMType.
Constructing HTTP client.
Leaving Get-VssHttpClient.
Entering Get-VssHttpClient.
TypeName: 'Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient'
SYSTEM_TEAMFOUNDATIONCOLLECTIONURI: 'http://[redacted]:8080/tfs/DefaultCollection/'
Entering Get-VssCredentials.
OMDirectory: ''
ENDPOINT_URL_SystemVssConnection: 'http://[redacted]:8080/tfs/DefaultCollection/'
ENDPOINT_AUTH_SystemVssConnection: '********'
ENDPOINT_DATA_SystemVssConnection (empty)
Entering Get-OMType.
TypeName: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
OMKind: 'WebApi'
OMDirectory: ''
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.OAuth.WebApi.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.OAuth.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.WebApi.dll'
Loading assembly: D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.WebApi.dll
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.OAuth.VssOAuthAccessTokenCredential'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.VisualStudio.Services.dll'
Not found.
Leaving Get-OMType.
Entering Get-OMType.
TypeName: 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential'
OMKind: 'WebApi'
OMDirectory: ''
Require: 'True'
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.VisualStudio.Services.Client.VssOAuthCredential'
The type was loaded successfully.
Leaving Get-OMType.
Leaving Get-VssCredentials.
Entering Get-OMType.
TypeName: 'Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient'
OMKind: 'WebApi'
OMDirectory: ''
Require: 'True'
Defaulted OM directory to: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6'
Testing whether type can be loaded: 'Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient'
The type was not loaded.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.Build.WebApi.WebApi.dll'
Not found.
Testing leaf path: 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.Build.WebApi.dll'
Loading assembly: D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\Microsoft.TeamFoundation.Build.WebApi.dll
Testing whether type can be loaded: 'Microsoft.TeamFoundation.Build.WebApi.BuildHttpClient'
The type was loaded successfully.
Leaving Get-OMType.
Constructing HTTP client.
Leaving Get-VssHttpClient.
GetBuildWorkItemsRefsAsync fb077072-07fd-4ba0-bd11-2753fc89f3af 48676
Loop workItemsRefs
Found WorkItemRef: 8052
Found WorkItem: 8052
Updating WorkItem 8052
Found KanbanColumn: WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column
Patch: /fields/System.State Done
Patch: /fields/WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column.Done False
Linking Build 48676 to WorkItem 8052
Patch: /relations/- vstfs:///Build/Build/48676
WorkItem 8052 updated to Done  False
Found WorkItemRef: 8050
Found WorkItem: 8050
Updating WorkItem 8050
Found KanbanColumn: WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column
Patch: /fields/System.State Done
Patch: /fields/WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column.Done False
Linking Build 48676 to WorkItem 8050
Patch: /relations/- vstfs:///Build/Build/48676
WorkItem 8050 updated to Done  False
Found WorkItemRef: 8038
Found WorkItem: 8038
Updating WorkItem 8038
Found KanbanColumn: WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column
Patch: /fields/System.State Done
Patch: /fields/WEF_04BD74D7381647D09952B444339E0E95_Kanban.Column.Done False
Linking Build 48676 to WorkItem 8038
Patch: /relations/- vstfs:///Build/Build/48676

Process is terminated due to StackOverflowException.
Exit code 255 returned from process: file name 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe', arguments '-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". ([scriptblock]::Create('if (!$PSHOME) { $null = Get-Item -LiteralPath ''variable:PSHOME'' } else { Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Management\Microsoft.PowerShell.Management.psd1'')) ; Import-Module -Name ([System.IO.Path]::Combine($PSHOME, ''Modules\Microsoft.PowerShell.Utility\Microsoft.PowerShell.Utility.psd1'')) }')) 2>&1 | ForEach-Object { Write-Verbose $_.Exception.Message -Verbose } ; Import-Module -Name 'D:\TfsData\Build\_work\_tasks\WorkItemUpdater_7164116a-ed17-48be-9c53-b440b2b1dd2e\1.3.6\ps_modules\VstsTaskSdk\VstsTaskSdk.psd1' -ArgumentList @{ NonInteractive = $true } -ErrorAction Stop ; $VerbosePreference = 'Continue' ; $DebugPreference = 'Continue' ; Invoke-VstsTaskScript -ScriptBlock ([scriptblock]::Create('. ''D:\TfsData\Build\_work...
@tbolon
Copy link
Contributor Author

tbolon commented Jul 24, 2017

Ok, nailed it.

We had a work-item whose state was not valid to move from current state to "Done" state (a required field was empty).

After I edited the specific work-item (8038 in my log) then the build succeed.

What we should need is something to better handle patch error. I do not understand why a StackOverflowException is raised when calling UpdateWorkItemAsync. Perhaps a native trace should be more helpful. The ideal case should be to raise an error with the detail of the Update error instead of a SOE.

Regards,

@BlueBasher
Copy link
Owner

Very stange it's throwing a StackOverflowException when there is an illegal state transition.
I'll have a look whether there's some way in the api to change this in a proper error.

@philcart
Copy link

We're encountering the same StackOverflowException. See attached Release Logs.

While I'd like to utilise this extension, we can't because of this error.

Cheers
Phil

ReleaseLogs_208.zip

@BlueBasher
Copy link
Owner

Just made a couple of changes #20 related to the StackOverflowException.
I reproduced one case of the SO and that is definitely fixed in this release.
There are multiple reasons for the SO Exception and made some other improvements that hopefully will resolve it.

These changes have been released in version 1.5.721 of the Build-Task.
I'll keep this issue open for now so if any of you are still seeing the issue please let me know so I can dig into it further.

@BlueBasher
Copy link
Owner

Closing since no reports of the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants