PopulateWithNonDefaultValues change from nullable to nonNullable

Hi,

I have recently tried upgrading Servicestack from 6.4 to 6.9.

One of my automated tests failed and with some investigation the PopulateWithNonDefaultValues changed its behaviour.

The method was used to override some properties with override settings (if specified.)
Eg:

bool Enabled {get;set;} was set to true on object.

bool? Enabled {get;set;} specified on the “from” class

Before the upgrade:

If Enabled on the “from” object came as null, no change was made.

After the upgrade:

If Enabled on the “from” object came as null, value is changed to false.

Any help is appreciated

If behavior was changed it’s likely fixing a bug/undesirable behavior, if you can provide a stand-alone repro I can take a look.

using NUnit.Framework;
using ServiceStack;

namespace Repro
{
    [TestFixture]
    public class Tests
    {
        [Test]
        public void TestPopulateWithNonDefaultValues()
        {
            var to = new To
            {
                Enabled = true,
            };

            var from = new From();

            to.PopulateWithNonDefaultValues(from);
            
            // 6.4 success, 6.9 fails
            Assert.True(to.Enabled);
        }
    }
    
    public class To
    {
        public bool Enabled { get; set; }
    }
    
    public class From
    {
        public bool? Enabled { get; set; }
    }
}

This is all that is needed to test.

Thanks this should be resolved from this commit.

Unfortunately as MyGet has been down all day today this is only available from our GitHub Packages Feed.