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.

Mapping Com Object: Missing type map configuration or unsupported mapping.

See original GitHub issue

I try to map a Interop Com Object to a .Net Object and getting a exception:

Missing type map configuration or unsupported mapping.

Mapping types:
ProjectTimeRecord -> TimeRecord
ComTimeRecording.ProjectTimeRecord -> AutoMapperTest.TimeRecord

Destination path:
TimeRecord

Source value:
System.__ComObject

The Interop library is a private dll, I cloud not share. I write minimal code to reproduce:

    class TimeRecord
    {
        public int Id { get; set; }
    }

    class Program
    {
        static void Main(string[] args)
        {
            ProjectTimeRecord projectTimeRecord = GetRecord();

            Console.WriteLine(projectTimeRecord.GetType());
            // Output: "System.__ComObjects"

            Mapper.CreateMap<ProjectTimeRecord, TimeRecord>();

            // Exception in next line
            TimeRecord record = Mapper.Map<ProjectTimeRecord, TimeRecord>(projectTimeRecord);
            Console.WriteLine(record.Id);
        }
    }

I use VS2015 RC, .NET 4.6 RC and AutoMapper 4.0.0-ci1061. On StackOverflow is a question with the same exception

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
kbkkcommented, Jul 16, 2017

Here’s an implementation for AutoMapper 6: https://gist.github.com/kbkk/437d92af4f3fc72ee9040f633d0ce988

AutoMapper.Mapper.Initialize(cfg =>
{
    cfg.Mappers.Add(new ComObjectMapper());
});
1reaction
lbargaoanucommented, Jun 9, 2016

This will output ApplicationClass, not __ComObject. And the mapping will work.

        var _x = (Microsoft.Office.Interop.Excel._Application) new Microsoft.Office.Interop.Excel.ApplicationClass();
        Console.WriteLine(_x);
        var _result = _mapper.Map<App>(_x);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Automapper missing type map configuration or ...
If the configuration isn't registered before calling the Map method, you will receive Missing type map configuration or unsupported mapping.
Read more >
Missing type map configuration or unsupported mapping
Hello guys, in this video we will learn about how to solve error Missing type map configuration or unsupported mapping in asp.net mvc....
Read more >
Missing type map configuration or unsupported mapping #30
The '**Missing type map configuration or unsupported mapping.' Is from automapper that changed a default settings, see their breaking changes.
Read more >
Missing type map configuration or unsupported mapping.
Hello everyone! I have a Nop version 3.50 that run just fine at my VS local, but after I deploy the solution to...
Read more >
Missing type map configuration or unsupported mapping
I am getting this error "Missing type map configuration or unsupported mapping" after every time my app restarts.
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