Parameterized test parameter serialization error causes host process to crash on Linux
TonEnfer opened this issue · 1 comments
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?
Parameterized test parameter serialization error causes host process to crash on Linux
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem
Here are 2 options on how you can reproduce this problem:
public class TestClass1
{
public static IEnumerable<object[]> Data1 => [[new TestData1(null)]];
[Theory]
[MemberData(nameof(Data1))]
public void TestCase1(TestData1 data1)
{ }
}
public class TestData1(string? property)
{
public string? Property => property ?? throw new Exception();
}
public class TestClass2
{
public static IEnumerable<object[]> Data2 => [[new TestData2()]];
[Theory]
[MemberData(nameof(Data2))]
public void TestCase2(TestData2 data2)
{ }
}
public class TestData2
{
public TestData2 This => this;
}
What is the expected behavior?
I expect the tests to complete successfully.
What is the motivation / use case for changing the behavior?
Tests complete successfully on Windows
Please tell us about your environment:
- Allure version: Irrelevant
- Test framework: XUnit@2.6.6
- Allure adaptor: Allure.XUnit@2.11.0
- Generate report using: Irrelevant
Other information
TestClass1 stacktrace
The active test run was aborted. Reason: Test host process crashed : Unhandled exception. Newtonsoft.Json.JsonSerializationException: Error getting value from 'Property' on 'AllureJsonSerializationBug.TestData1'.
---> System.Exception: Exception of type 'System.Exception' was thrown.
at AllureJsonSerializationBug.TestData1.get_Property() in /mnt/x/repos/Tests/AllureJsonSerializationBug/AllureJsonSerializationBug/TestClass.cs:line 19
at Newtonsoft.Json.Serialization.ExpressionValueProvider.GetValue(Object target)
--- End of inner exception stack trace ---
at Newtonsoft.Json.Serialization.ExpressionValueProvider.GetValue(Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value)
at Allure.Net.Commons.Functions.FormatFunctions.Format(Object value, IReadOnlyDictionary2 formatters) at Allure.Xunit.AllureXunitHelper.<>c.<ApplyTestParameters>b__7_0(IParameterInfo param, Object value) at System.Linq.Enumerable.ZipIterator[TFirst,TSecond,TResult](IEnumerable
1 first, IEnumerable1 second, Func
3 resultSelector)+MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable
1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at Allure.Xunit.AllureXunitHelper.ApplyTestParameters(IEnumerable
1 parameters, Object[] arguments)
at Allure.XUnit.AllureMessageSink.AddAllureParameters(ITest test, Object[] arguments)
at Allure.XUnit.AllureMessageSink.<>c__DisplayClass14_0.b__0()
at Allure.Net.Commons.AllureLifecycle.RunInContext(AllureContext context, Action action)
at Allure.XUnit.AllureMessageSink.RunInTestContext(ITest test, Action action)
at Allure.XUnit.AllureMessageSink.OnTestFinished(MessageHandlerArgs1 args) at MessageSinkMessageExtensions.Dispatch[TMessage](IMessageSinkMessage message, HashSet
1 messageTypes, MessageHandler1 callback) in /_/src/xunit.runner.utility/Extensions/MessageSinkMessageExtensions.cs:line 39 at Xunit.ExecutionEventSink.OnMessageWithTypes(IMessageSinkMessage message, HashSet
1 messageTypes) in //src/xunit.runner.utility/Sinks/EventSinks/ExecutionEventSink.cs:line 167
at Xunit.AggregateMessageSink.OnMessageWithTypes(IMessageSinkMessage message, HashSet1 messageTypes) in /_/src/xunit.runner.utility/Sinks/AggregateMessageSink.cs:line 66 at Xunit.Runner.VisualStudio.VsExecutionSink.OnMessageWithTypes(IMessageSinkMessage message, HashSet
1 messageTypes) in //src/xunit.runner.visualstudio/Sinks/VsExecutionSink.cs:line 318
at Xunit.ExecutionSink.OnMessageWithTypes(IMessageSinkMessage message, HashSet1 messageTypes) in /_/src/xunit.runner.utility/Sinks/ExecutionSink.cs:line 444 at Xunit.MessageSinkAdapter.OnMessageWithTypes(IMessageSinkMessage message, HashSet
1 messageTypes) in //src/xunit.runner.utility/Messages/MessageSinkAdapter.cs:line 50
at Xunit.OptimizedRemoteMessageSink.OnMessage(IMessageSinkMessage message) in //src/xunit.runner.utility/Messages/OptimizedRemoteMessageSink.cs:line 56
at Xunit.Sdk.SynchronousMessageBus.QueueMessage(IMessageSinkMessage message) in //src/xunit.execution/Sdk/SynchronousMessageBus.cs:line 30
at Xunit.Sdk.TestRunner1.RunAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestRunner.cs:line 180 at Xunit.Sdk.XunitTheoryTestCaseRunner.RunTestAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/XunitTheoryTestCaseRunner.cs:line 194 at Xunit.Sdk.TestCaseRunner
1.RunAsync() in //src/xunit.execution/Sdk/Frameworks/Runners/TestCaseRunner.cs:line 82
at Xunit.Sdk.TestMethodRunner1.RunTestCasesAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestMethodRunner.cs:line 136 at Xunit.Sdk.TestMethodRunner
1.RunAsync() in //src/xunit.execution/Sdk/Frameworks/Runners/TestMethodRunner.cs:line 106
at Xunit.Sdk.TestClassRunner1.RunTestMethodsAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestClassRunner.cs:line 228 at Xunit.Sdk.TestClassRunner
1.RunAsync() in //src/xunit.execution/Sdk/Frameworks/Runners/TestClassRunner.cs:line 175
at Xunit.Sdk.TestCollectionRunner1.RunTestClassesAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestCollectionRunner.cs:line 130 at Xunit.Sdk.TestCollectionRunner
1.RunAsync() in //src/xunit.execution/Sdk/Frameworks/Runners/TestCollectionRunner.cs:line 101
at Xunit.Sdk.XunitTestAssemblyRunner.RunTestCollectionsAsync(IMessageBus messageBus, CancellationTokenSource cancellationTokenSource) in //src/xunit.execution/Sdk/Frameworks/Runners/XunitTestAssemblyRunner.cs:line 232
at Xunit.Sdk.TestAssemblyRunner1.RunAsync() in /_/src/xunit.execution/Sdk/Frameworks/Runners/TestAssemblyRunner.cs:line 208 at Xunit.Sdk.XunitTestFrameworkExecutor.RunTestCases(IEnumerable
1 testCases, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFrameworkExecutor.cs:line 96
at System.Threading.Tasks.Task.<>c.b__128_1(Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
Test Run Aborted.