question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mapper not initialized

See original GitHub issue

An exception of type ‘System.InvalidOperationException’ occurred in AutoMapper.dll but was not handled in user code

Additional information: Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you’re using ProjectTo or UseAsDataSource extension methods, make sure you pass in the appropriate IConfigurationProvider instance.

[AutoMapFrom(typeof(Provider))]
public class ProviderListDto : EntityDto<long>
{
    public string Name { get; set; }
    public string Email { get; set; }
    public Guid Guid { get; set; }
}

public class Provider : Entity<long>
{
    public Provider()
    {
    }

    [Required]
    [MaxLength(128)]
    public string Name { get; set; }
    [Required]
    [EmailAddress]
    public string Email { get; set; }

    [Required]
    public Guid Guid { get; set; }
}

What is wrong?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
malimingcommented, Jul 10, 2018

@Immanuel-Licht

Is it related to this? #2052

0reactions
malimingcommented, Jul 10, 2018

No problem. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automapper error saying mapper not initialized
"Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or ...
Read more >
'Mapper not initialized. Call Initialize with appropriate ...
If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the...
Read more >
unit test failing for mapper not initialized #5065
Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or ...
Read more >
C# – Mapper not initialized. Call Initialize with appropriate ...
Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, ...
Read more >
Mapper not initialized #7471
Hi, after the update of my solution to v7.1.0 for ASP.NET MVC 5.x & Angularjs 1.x .NET Framework 4.6.1 I've this expection in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found