Our Specflow project started to fail the build with "Process is terminated due to StackOverflowException".
I was able to trim down the test project down to just one feature file like this:
Feature: PDBSPCTK Get Availability groups (Avgpad) - Tux
Scenario: Get availability groups JSON
Given I create the following "Avgpad" class and save it as "Avgpad"
Then I verify the "Response_Avgpar" object contains the following data
"""
LARGE JSON DATA
"""
Below is the build output:
Build started at 10:51 AM...
1>------ Build started: Project: TestAutomation, Configuration: Debug Any CPU ------
1> SpecFlowFeatureFiles: PDBSPCTK\ACSR\Avgpad\Tux\GetAvgpadTux.feature;PDBSPCTK\psRetrieveCCSAccountAndCustomerByUD\Db\RetrieveCCSAccountAndCustomerByUD.feature;PDBSPCTK\psRetrieveCCSAccountAndCustomerByUD\Tux\RetrieveCCSAccountAndCustomerByUD.feature
1> SpecFlowGeneratedFiles: PDBSPCTK\ACSR\Avgpad\Tux\GetAvgpadTux.feature.cs
1> SpecFlowGeneratedFiles: PDBSPCTK\psRetrieveCCSAccountAndCustomerByUD\Db\RetrieveCCSAccountAndCustomerByUD.feature.cs
1> SpecFlowGeneratedFiles: PDBSPCTK\psRetrieveCCSAccountAndCustomerByUD\Tux\RetrieveCCSAccountAndCustomerByUD.feature.cs
1> SourceRoot value was 'C:\Users\qiuw01\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\'
1> SourceRoot value is 'C:\Users\qiuw01\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\;C:\Users\qiuw01\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\'
1> SourceRoot.SourceControl is ''
1> SourceRoot.MappedPath is 'C:\Users\qiuw01\.nuget\packages\'
1> SourceRoot.MappedPath is 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\'
1> SourceRoot.SourceLinkUrl is ''
1>C:\Users\qiuw01\.nuget\packages\microsoft.sourcelink.common\1.0.0\build\Microsoft.SourceLink.Common.targets(52,5): warning : Source control information is not available - the generated source link is empty.
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(84,5): error :
1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets(84,5): error : Process is terminated due to StackOverflowException.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 10:51 AM and took 14.314 seconds ==========
Additional information:
- Stack overflow appears to be related to the size of LARGE JSON DATA. Stack overflow stops to happen once its size is reduced.
- Stack overflow started to happen after an upstream package introduced dependency on System.Text.Json.
So my question is how indirect dependency on System.Text.Json can cause Specflow to be sensitive to the JSON data size in a feature file?
I can report our findings and solution.