Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1038155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:56:24+00:00 2026-05-16T14:56:24+00:00

i keep getting this error: Exception Details: System.NotSupportedException: Cannot serialize member HannaPrintsDataAccess.Customer.CustomerAddresses of type

  • 0

i keep getting this error:

Exception Details:
System.NotSupportedException: Cannot
serialize member
HannaPrintsDataAccess.Customer.CustomerAddresses
of type
System.Collections.Generic.IList`1[[HannaPrintsDataAccess.CustomerAddress,
HannaPrintsDataAccess,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null]] because it is an
interface.

Here is the stack trace: [NotSupportedException: Cannot
serialize member
HannaPrintsDataAccess.Customer.CustomerAddresses
of type
System.Collections.Generic.IList`1[[HannaPrintsDataAccess.CustomerAddress,
HannaPrintsDataAccess,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null]] because it is an
interface.]

[InvalidOperationException: Cannot
serialize member
‘HannaPrintsDataAccess.Customer.CustomerAddresses’
of type
‘System.Collections.Generic.IList`1[[HannaPrintsDataAccess.CustomerAddress,
HannaPrintsDataAccess,
Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null]]’, see inner
exception for more details.]
System.Xml.Serialization.StructModel.CheckSupportedMember(TypeDesc
typeDesc, MemberInfo member, Type
type) +889917
System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo
propertyInfo) +132
System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo
memberInfo) +129
System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping
mapping, StructModel model, Boolean
openModel, String typeName,
RecursionLimiter limiter) +1226
System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel
model, String ns, Boolean openModel,
XmlAttributes a, RecursionLimiter
limiter) +460
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
model, String ns, ImportContext
context, String dataType,
XmlAttributes a, Boolean repeats,
Boolean openModel, RecursionLimiter
limiter) +1415

[InvalidOperationException: There was
an error reflecting type
‘HannaPrintsDataAccess.Customer’.]
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
model, String ns, ImportContext
context, String dataType,
XmlAttributes a, Boolean repeats,
Boolean openModel, RecursionLimiter
limiter) +1621
System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping
accessor, FieldModel model,
XmlAttributes a, String ns, Type
choiceIdentifierType, Boolean rpc,
Boolean openModel, RecursionLimiter
limiter) +10296
System.Xml.Serialization.XmlReflectionImporter.ImportFieldMapping(StructModel
parent, FieldModel model,
XmlAttributes a, String ns,
RecursionLimiter limiter) +139
System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping
mapping, StructModel model, Boolean
openModel, String typeName,
RecursionLimiter limiter) +1273

[InvalidOperationException: There was
an error reflecting property
‘Customer’.]
System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(StructMapping
mapping, StructModel model, Boolean
openModel, String typeName,
RecursionLimiter limiter) +2167
System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel
model, String ns, Boolean openModel,
XmlAttributes a, RecursionLimiter
limiter) +460
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
model, String ns, ImportContext
context, String dataType,
XmlAttributes a, Boolean repeats,
Boolean openModel, RecursionLimiter
limiter) +1415

[InvalidOperationException: There was
an error reflecting type
‘HannaPrintsDataAccess.CustomerAddress’.]
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
model, String ns, ImportContext
context, String dataType,
XmlAttributes a, Boolean repeats,
Boolean openModel, RecursionLimiter
limiter) +1621
System.Xml.Serialization.XmlReflectionImporter.CreateArrayElementsFromAttributes(ArrayMapping
arrayMapping, XmlArrayItemAttributes
attributes, Type arrayElementType,
String arrayElementNs,
RecursionLimiter limiter) +227
System.Xml.Serialization.XmlReflectionImporter.ImportArrayLikeMapping(ArrayModel
model, String ns, RecursionLimiter
limiter) +207
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
model, String ns, ImportContext
context, String dataType,
XmlAttributes a, Boolean repeats,
Boolean openModel, RecursionLimiter
limiter) +1143

[InvalidOperationException: There was
an error reflecting type
‘HannaPrintsDataAccess.CustomerAddress[]’.]
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
model, String ns, ImportContext
context, String dataType,
XmlAttributes a, Boolean repeats,
Boolean openModel, RecursionLimiter
limiter) +1621
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel
model, String ns, ImportContext
context, String dataType,
XmlAttributes a, RecursionLimiter
limiter) +28
System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel
model, XmlRootAttribute root, String
defaultNamespace, RecursionLimiter
limiter) +125
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type
type, XmlRootAttribute root, String
defaultNamespace) +97
System.Xml.Serialization.XmlSerializer..ctor(Type
type, String defaultNamespace) +461
System.Xml.Serialization.XmlSerializer..ctor(Type
type) +6
HannaPrintsBusiness.Services.Live.CustomerService.GetCustomerAddressesXml(CustomerAddress[]
customerAddresses) in
E:\ProjectsOld\HannaPrints\HannaPrintsBusiness\Services\Live\CustomerService.cs:148
CreateGreetingCard.orderButton_Click(Object
sender, EventArgs e) in
c:\HostingSpaces\greetwus\galadavetiye.com\wwwroot\HannaPrints\HannaPrints\WebUI\CreateGreetingCard.aspx.cs:198
System.Web.UI.WebControls.Button.OnClick(EventArgs
e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
+13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) +1565

I cant seem to figure this out, I am pretty sure its just some configuration that needs to be changed because before we got this code, supposedly it was working correctly, but we cant figure out why we are getting this error. If anyone could help that would be great. Thanks!!!

UPDATE
I tried changing the IList to List, but it does not do anything. Here is my classes with the customer address:

CUSTOMER CLASS:::

using System;

using System.Collections.Generic;
using Castle.ActiveRecord;

namespace HannaPrintsDataAccess
{
public partial class Customer
{
private IList _customerAddresses;

    public CustomerAddress GetPrimaryCustomerAddress()
    {
        foreach (CustomerAddress address in _customerAddresses)
        {
            if (address.IsPrimary)
                return address;
        }
        return null;
    }


    [HasMany(typeof(CustomerAddress), ColumnKey = "CustomerId", Table = "Customer")]
    public virtual IList<CustomerAddress> CustomerAddresses
    {
        get
        {
            return this._customerAddresses;
        }
        set
        {
            this._customerAddresses = value;
        }
    }
}

}

Here is the Customer Address class::::

using System.IO;

using System.Xml.Serialization;
using Castle.ActiveRecord;

namespace HannaPrintsDataAccess
{
public partial class CustomerAddress
{
public string ToXml()
{
XmlSerializer serializer = new XmlSerializer(GetType());
MemoryStream memoryStream = new MemoryStream();
serializer.Serialize(memoryStream, this);
memoryStream.Seek(0, SeekOrigin.Begin);
return new StreamReader(memoryStream).ReadToEnd();
}

    [BelongsTo("CustomerId")]
    public virtual Customer Customer { get; set; }
}

}

Thanks again for your help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:56:25+00:00Added an answer on May 16, 2026 at 2:56 pm

    As the error message explicitly tells you the XmlSerializer cannot serialize interfaces.

    You probably had:

    public List<CustomerAddress> CustomerAddresses  { get; set; }
    

    which you changed to:

    public IList<CustomerAddress> CustomerAddresses  { get; set; }
    

    which no longer works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use slime from CVS (2009-01-05) but keep getting this error: LOAD:
OK I keep getting this error after about 3-4 minutes of churning: Timeout expired.
I keep getting this NPE in my application and I can't seem to get
I keep getting tasks that are above my skill level. How can I address this without coming accross as grossly incompetent?
I keep getting a PermGen error on my Tomcat 6 server. I know what
I keep getting stuck conceptually on deciding an Exception-handling structure for my project. Suppose
I want to rename a database, but keep getting the error that 'couldn't get
I cannot figure out why I keep getting a null ref on filename when
I keep getting compiler errors when I try to access flashVars in an AS3
I keep getting asked about AppDomains in interviews, and I know the basics :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.