fullserializer icon indicating copy to clipboard operation
fullserializer copied to clipboard

Unit test failing: TestDeserializeInvalidTypeInfo

Open hymerman opened this issue 9 years ago • 1 comments

This test is failing (commented out assertion) in Unity 5.5:

    [Test]
    public void TestDeserializeInvalidTypeInfo() {
        Action<fsData> AssertSuccess = typeData => {
            var data = fsData.CreateDictionary();
            data.AsDictionary["$type"] = typeData;
            data.AsDictionary["a"] = new fsData(1);

            var model = default(Model);
            var result = (new fsSerializer()).TryDeserialize(data, ref model).AssertSuccess();
            Debug.Log(result.FormattedMessages);

            Assert.AreEqual(1, model.a);
        };

        AssertSuccess(fsData.CreateDictionary());
        AssertSuccess(fsData.CreateList());
        //AssertSuccess(new fsData("invalid type name")); // Disabling for now as this fails on Unity 5.5 upgrade
        AssertSuccess(new fsData("System.Object")); // the wrong type
    }

Here's a version of the message I get (actually from Team City):

======= Failed test run #1 ==========
System.Exception : Unable to locate specified type "invalid type name"
  at FullSerializer.fsResult.AssertSuccess () [0x00018] in C:\TeamCityBuildAgent\work\fe8e2d48a89c08bf\TH20\Assets\Plugins\FullSerializer\Source\fsResult.cs:154 
  at FullSerializer.Tests.ErrorRecoveryTests.<TestDeserializeInvalidTypeInfo>m__0 (FullSerializer.fsData typeData) [0x00058] in C:\TeamCityBuildAgent\work\fe8e2d48a89c08bf\TH20\Assets\Plugins\FullSerializer\Testing\Editor\ErrorRecoveryTests.cs:58 
  at FullSerializer.Tests.ErrorRecoveryTests.TestDeserializeInvalidTypeInfo () [0x0004e] in C:\TeamCityBuildAgent\work\fe8e2d48a89c08bf\TH20\Assets\Plugins\FullSerializer\Testing\Editor\ErrorRecoveryTests.cs:66 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222 

I've had a quick look but I have no idea why it would be failing.

Note that in my case I have moved FullSerializer inside "Assets/Plugins". But it was working with Unity 5.4.0f3.

Also note that I'm upgrading from 5.4.0f3 to 5.5.0p1 so it could actually have started breaking at any version in-between :)

This is with the latest FullSerializer code as of the time I'm posting the issue.

hymerman avatar Dec 13 '16 16:12 hymerman

Oh! Disregard the part about Unity 5.5. Turns out the test was failing in Unity 5.4.0f3 too, it's just that Unity's behaviour in choosing which tests get run seems to have changed in 5.5 so it wasn't getting run for us.

It's still an issue though - that one assert is failing.

hymerman avatar Dec 13 '16 16:12 hymerman