4.5.0 PopulateWithNonDefaultValues throwing Object reference exception

Just trying 4.5.0 with simple examples, and getting a null exception when using AutoMapping.

Created a .net core web project, added ServiceStack.Text 4.5.0, and these:

public class A
  public int Id { get; set; }
public class B
  public int Id { get; set; }

then right at the start:

new B().PopulateWithNonDefaultValues(new A());


System.NullReferenceException was unhandled by user code
Message=Object reference not set to an instance of an object.
at ServiceStack.PropertyInvoker.GetPropertyGetterFn(PropertyInfo propertyInfo)
at ServiceStack.AssignmentMember.GetGetValueFn()
at ServiceStack.AssignmentEntry…ctor(String name, AssignmentMember from, AssignmentMember to)
at ServiceStack.AssignmentDefinition.AddMatch(String name, AssignmentMember readMember, AssignmentMember writeMember)
at ServiceStack.AutoMappingUtils.<>c__DisplayClass15_0.b__0(String )
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at ServiceStack.AutoMappingUtils.GetAssignmentDefinition(Type toType, Type fromType)
at ServiceStack.AutoMappingUtils.PopulateWithNonDefaultValues[To,From](To to, From from)
at WebApplication1.Startup.ConfigureServices(IServiceCollection services) in Startup.cs:line 21

Is there initialisation or some other dependencies I’ve missed?

Forget it. I’m an idiot. I thought 4.5.0 was the new core release, but now see it’s ServiceStack.Text.Core. Guess I’m kind of surprised it let me add it so easily.

However, maybe the report is still useful since it probably shouldn’t crash.

It won’t crash in .NET 4.5, but you can’t use this library in .NET Core because it will use the PCL version which will be installed without the platform-specific implementations that are in ServiceStack.Client