Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidProgramException when AutoMapping Enum of type byte #248

Closed
mafifi opened this issue Sep 24, 2012 · 3 comments
Closed

InvalidProgramException when AutoMapping Enum of type byte #248

mafifi opened this issue Sep 24, 2012 · 3 comments

Comments

@mafifi
Copy link

mafifi commented Sep 24, 2012

AutoMapper can't seem to handle mapping Enums of type byte.
Simple example below.
More debug details included on StackOverflow

using AutoMapper
namespace Test
{

    public enum PriorityType : byte
    {
        Low = 0,
        Medium,
        High,
        Urgent
    }

    [Serializable]
    public enum PriorityTypeDto// : byte
    {
        Low = 0,
        Medium,
        High,
        Urgent
    }

    public class Program
    {
        public void Main()
        {
            Mapper.CreateMap<PriorityType, PriorirtyTypeDto>();
        }
    }
}
@jbogard
Copy link
Member

jbogard commented Sep 24, 2012

Answered on SO too:

You don't need the CreateMap call - AutoMapper automatically handles enum types without any configuration. Just remove CreateMap and you're set.

@jbogard jbogard closed this as completed Sep 24, 2012
@mafifi
Copy link
Author

mafifi commented Sep 24, 2012

Thanks for that, confirmed that works.

@lock
Copy link

lock bot commented May 8, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants