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

Random exception during test execution #481

Open
1 of 3 tasks
kemsky opened this issue Apr 4, 2024 · 6 comments
Open
1 of 3 tasks

Random exception during test execution #481

kemsky opened this issue Apr 4, 2024 · 6 comments

Comments

@kemsky
Copy link

kemsky commented Apr 4, 2024

I'm submitting a ...

  • 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.<AfterTest>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:

@delatrie
Copy link
Contributor

delatrie commented Apr 5, 2024

Hi, @kemsky !

Do you define Allure fixtures with AllureBefore or AllureAfter ? If so, do you define steps in them? Do fixtures or steps have parameters? If yes, what types do you use?

@kemsky
Copy link
Author

kemsky commented Apr 5, 2024

@delatrie, there is no AllureBefore or AllureAfter in my tests, also there are no steps at all. Some tests have TestCase attributes, types are primitive, numbers, strings, enums.

SetUpFixture :

[SetUpFixture]
public class TestInitializer
{
    [OneTimeSetUp]
    public void Setup()
    {
        CultureContext.SetThreadCulture();
    }

    [OneTimeTearDown]
    public void Teardown()
    {
    }
}

A couple of tests have [SetUp] attribute.

Many tests are marked with [Parallelizable(ParallelScope.All)].

@delatrie
Copy link
Contributor

delatrie commented Apr 5, 2024

Ok, thank you for your quick response.
How often does the exception occur?

@kemsky
Copy link
Author

kemsky commented Apr 5, 2024

Approximately 1 out of 10 runs fails

@kemsky
Copy link
Author

kemsky commented Apr 5, 2024

There are ~500 tests.

@delatrie
Copy link
Contributor

delatrie commented Apr 5, 2024

My first impression is that there is a data race somewhere in our code. Does turning off the parallelization help?

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

No branches or pull requests

2 participants