Build/Test Issues

NCrunch cannot discover tests due to serialization issues

Started by zvirja on 3,365 views

Steps to reproduce:
1. Checkout the AutoFixture repo: https://github.com/AutoFixture/AutoFixture
2. Open the Src/AutoFixture.sln project.
3. Try to discover all the tests.

Result:
Discovery fails for .NET Core App framework. Here are examples of errors:


An error occurred while analysing this project after it was built: System.Exception: Error while discovering test 'AutoFixtureUnitTest.RandomRangedNumberGeneratorTest.CreationOnFullRangeShouldntFail("System.SByte", "-128", "127")':System.Runtime.Serialization.SerializationException: Unknown primitive type: System.SByte
at nCrunch.Common.Serialization.BinarySerializer.writePrimitiveType(BinaryWriter writer, Object value)
at nCrunch.Common.Serialization.BinarySerializer.WriteInstance(SerializationContext context, Object instance, Type knownInstanceType, Boolean cacheCollectionContents)
at nCrunch.Common.Serialization.BinarySerializer.Serialize(SerializationContext context, Object instance, Type knownInstanceType, Boolean cacheInstance, Boolean cacheCollectionContents)
at nCrunch.Common.Serialization.CustomTypeSerializers.ObjectArraySerializer.Serialize(SerializationContext context, SerializationContractType type, Object value, Boolean cacheCollectionContents)
at nCrunch.Common.Serialization.BinarySerializer.WriteInstance(SerializationContext context, Object instance, Type knownInstanceType, Boolean cacheCollectionContents)
at nCrunch.Common.Serialization.BinarySerializer.Serialize(SerializationContext context, Object instance, Type knownInstanceType, Boolean cacheInstance, Boolean cacheCollectionContents)
at nCrunch.Module.XUnit2.XUnitBinarySerializer.Serialize(Stream stream, Object graph)
at nCrunch.TestExecution.Frameworks.XUnit2.TestCaseArgumentData.StoreInTest(FrameworkTest test)
at nCrunch.Module.XUnit2.Integration.XUnitNCrunchDiscoveredTestContainer.StoreDiscoveredTest(ITestCase testCase, TestName testName)
at nCrunch.Module.XUnit2.Integration.XUnitDiscoveryMessageSink.discoverTest(ITestCase testCase)



Error while discovering test 'AutoFixtureUnitTest.Kernel.MultidimensionalArrayRelayTest.Create3DimensionalArrayReturnsCorrectResult([[["12"]]], ["12"])':System.Runtime.Serialization.SerializationException: Cannot find serialization contract for type: System.Int32[][]


Expected result:
Discovery should pass successfully.

Notes:
For history: current SHA1 of the master is c7a27680155bcaf22dc1f6e6d62f14cc8614217c.

It seems you cannot serialize SByte and multi-dimensional arrays.

Thank you!

Edited

Hi, thanks for sharing this problem.

It looks like we are missing a type in our binary serializer. From what I can determine, this will affect .NET Core projects (not .NET Framework ones).

I'll make sure this gets fixed in the next release. Thanks for bringing it to my attention!
Thank for your the confirmation! Will be nice to have it working ;-)

P.S. Thank you for the great product you are making. It totally changed my coding experience and now it's hard to imagine my life without this tool.
zvirja wrote:
P.S. Thank you for the great product you are making. It totally changed my coding experience and now it's hard to imagine my life without this tool.


Thank you for your efforts on AutoFixture! :)

Post a reply

Log in to reply.