I'm trying to get the contacts but while creating an instance of xconnect client, I'm getting the following exception:

Type must have a parameterless constructor (not necessarily public) or a public constructor that only takes parameters that correspond to primitive types

Here is the pseudo code for reference.

using (XConnectClient client = SitecoreXConnectClientConfiguration.GetClient())
          List<Contact> contacts = null;
          contact = client.Get<Contact>(new IdentifiedContactReference(AssemblyFacetInformation.ContactReference, "bcc746fa19cd6fddf0203aa443eebd11"), new ContactExecutionOptions(new ContactExpandOptions(AssemblyFacetInformation.ContactReference)));
          var contact = contacts.FirstOrDefault();
          var assemblyFacetInformation = contact.GetFacet<AssemblyFacetInformation>(AssemblyFacetInformation.Timezone);
          assemblyFacetInformation.TimeZone = windowsTimeZone;
          client.SetFacet(contact, AssemblyFacetInformation.Timezone, assemblyFacetInformation);


My Custom model class

public class AssemblyFacetCollectionModel
    public static XdbModel Model { get; } = BuildAssemblyModel();
    static XdbModel BuildAssemblyModel()
      XdbModelBuilder xdbModelBuilder = new XdbModelBuilder("AssemblyFacetInformation", new XdbModelVersion(1, 0));
      xdbModelBuilder.DefineFacet<Contact, AssemblyFacetInformation>(AssemblyFacetInformation.DefaultFacetKey);
      return xdbModelBuilder.BuildModel();

This is my facet class

  public class AssemblyFacetInformation : Facet
    public const string IdentifierCookieName = "_assembly_visitor_id";
    public const string AnalyticsCookieName = "analytics_uuid";
    public const string MetroCookieName = "metro";
    public const string ContactReference = "Assembly_Visitor";
    public const string DefaultFacetKey = "AssemblyFacetKey";
    public const string Timezone = "Timezone";
    public AssemblyFacetInformation() { }

    public Metro metro { get; set; }
    [JsonProperty("geolocated_location")] //From "metro" Cookie
    public string GeoLocation { get; set; } //From "metro" Cookie
    public float DistanceFromMetro { get; set; } //From "metro" Cookie
    public float UserLatitude { get; set; } //From "metro" Cookie
    public float UserLongitude { get; set; } //From "metro" Cookie
    public bool PrioritizeOnline { get; set; } //From "metro" Cookie
    //public string ShopSession { get; set; } //From "_shop_session" Cookie
    public TimeZoneInfo TimeZone { get; set; }


While debugging the process I found that exception originally thrown by the AssemblyFacetCollectionModel class on this line

      return xdbModelBuilder.BuildModel();

Did I miss something or doing anything wrong??

  • Try commenting out Metro and TimeZone fields temporarily. I think they are the reason of your issues.
    – Marek Musielak
    Commented Nov 25, 2022 at 11:42
  • You were right @MarekMusielak these two fields were creating an issue. But now I'm getting this error. One or more local models conflict with the xDB service layer. 'AssemblyFacetKey, 1.0' does not have a remote version' Commented Nov 25, 2022 at 12:29
  • You should not mix multiple questions in one post. Create new question describing the whole situation.
    – Marek Musielak
    Commented Nov 25, 2022 at 13:09

1 Answer 1


The issue is with Metro and TimeZoneInfo types.

Either remove them or make sure that they are registered properly in your model and have proper constructors.

Read more about type restrictions here:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.