Skip to content
This repository was archived by the owner on May 22, 2026. It is now read-only.
This repository was archived by the owner on May 22, 2026. It is now read-only.

DeepMap() can't copy dynamic objects #2

Description

@antonovicha
        public class D11
        {
            public object D;
        }
        public class D12
        {
            public object D;
        }

        [Test]
        public void Dynamic_to_Dynamic()
        {
            var mapper = ObjectMapperManager
                .DefaultInstance
                .GetMapper<D11, D12>(
                    new DefaultMapConfig()
                    .DeepMap()
                );

            var det = new { D = 1 };
            var result = mapper.Map(new D11() { D = det });

            Assert.AreEqual(det.D, ((dynamic)result.D).D); //FAIL
        }

Instead of deep copy of an object result.D contains empty System.Object.
Possible solution is to construct ExpandoObject and then deep copy all other fields.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions