allure-framework / allure-framework/allure-csharp
Random exception during test execution
- Dominant language
- C#
- Stars
- 125
- Forks
- 76
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 18
Description
#### I'm submitting a ...
- [x] bug report
- [ ] feature request
- [ ] support request => Please do not submit support request here, see note at the top of this template.
#### What is the current behavior?
```
[22:05:51][dotnet test] The active test run was aborted. Reason: Test host process crashed : Unhandled exception. System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
[22:05:51][dotnet test] at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
[22:05:51][dotnet test] at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
[22:05:51][dotnet test] at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
[22:05:51][dotnet test] at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
[22:05:51][dotnet test] at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
[22:05:51][dotnet test] at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
[22:05:51][dotnet test] at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
[22:05:51][dotnet test] at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value)
[22:05:51][dotnet test] at Newtonsoft.Json.JsonSerializer.Serialize(TextWriter textWriter, Object value)
[22:05:51][dotnet test] at Allure.Net.Commons.Writer.FileSystemResultsWriter.Write(Object allureObject, String fileSuffix)
[22:05:51][dotnet test] at Allure.Net.Commons.Writer.FileSystemResultsWriter.Write(TestResultContainer testResult)
[22:05:51][dotnet test] at Allure.Net.Commons.AllureLifecycle.WriteTestContainer()
[22:05:51][dotnet test] at Allure.NUnit.Core.AllureNUnitHelper.StopTestContainer()
[22:05:51][dotnet test] at Allure.NUnit.AllureNUnitAttribute.<>c__DisplayClass2_0.b__0()
[22:05:51][dotnet test] at Allure.NUnit.AllureNUnitAttribute.RunHookInRestoredAllureContext(ITest test, Action action)
[22:05:51][dotnet test] at Allure.NUnit.AllureNUnitAttribute.AfterTest(ITest test)
[22:05:51][dotnet test] at NUnit.Framework.Internal.Commands.TestActionItem.AfterTest(ITest test)
[22:05:51][dotnet test] at NUnit.Framework.Internal.Commands.AfterTestActionCommand.<>c__DisplayClass0_0.<.ctor>b__0(TestExecutionContext context)
[22:05:51][dotnet test] at NUnit.Framework.Internal.Commands.AfterTestCommand.Execute(TestExecutionContext context)
[22:05:51][dotnet test] at NUnit.Framework.Internal.Execution.CompositeWorkItem.PerformOneTimeTearDown()
[22:05:51][dotnet test] at NUnit.Framework.Internal.Execution.CompositeWorkItem.OneTimeTearDownWorkItem.Execute()
[22:05:51][dotnet test] at NUnit.Framework.Internal.Execution.TestWorker.TestWorkerThreadProc()
[22:05:51][dotnet test] at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
[22:05:51][dotnet test] --- End of stack trace from previous location ---
[22:05:51][dotnet test] at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
```
#### If the current behavior is a bug, please provide the steps to reproduce and, if possible, a minimal demo of the problem
#### Please tell us about your environment:
- OS Windows
- .NET framework .NET 8
- Test framework: nunit@4.1.0
- Allure adapter: allure-nunit@2.12.0
Contributor guide
Research direction
Start by reproducing the crash with .NET 8, NUnit 4.1.0, and allure-nunit 2.12.0. Trace the stack from Allure.NUnit.AllureNUnitAttribute.AfterTest through AllureLifecycle.WriteTestContainer to Allure.Net.Commons.Writer.FileSystemResultsWriter.Write. Done means test execution no longer aborts with the collection-modified exception, with a regression test covering the failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100