bltoolkit icon indicating copy to clipboard operation
bltoolkit copied to clipboard

VerificationException "Operation could destabilize the runtime." when mapping

Open starteleport opened this issue 13 years ago • 0 comments

Hello! I'm getting VerificationException when trying to map like this:

        #region Types for VerificationFailedExceptionTest

        public class Class1
        {
            public string Token { get; set; }
        }

        public class Class2
        {
            private readonly string _token;

            [MapField(Storage = "_token")]
            public string Token
            {
                get { return _token; }
            }
        }

        #endregion

        [TestMethod]
        public void VerificationFailedExceptionTest_Fails()
        {
            var ormToDomain = Map.GetObjectMapper<Class1, Class2>();

            Class1 record = new Class1 { Token = "test" };
            ormToDomain(record);
        }

However, the test passes when I remove readonly from _token. Complete unit tests are here: https://gist.github.com/4690146

BTW, it's Framework 4.0, VS 2010

starteleport avatar Feb 01 '13 08:02 starteleport