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.

Custom value resolver doesn't work when `AddConditionalObjectMapper()` is used

See original GitHub issue

A minimal repro of this issue is here.

When using a simple custom value resolver that just maps an inner property, and AddConditionalObjectMapper() has been configured, the returned mapped value doesn’t reflect what the value resolver returned. It’s still being called though, but it’s like the returned value isn’t being used.

If I comment out the call to AddConditionalObjectMapper() everything works as expected (please check the repro).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jbogardcommented, Jul 1, 2017

Just never misspell anything 😃

On Sat, Jul 1, 2017 at 12:52 PM Mohammad Rahhal notifications@github.com wrote:

@TylerCarlson1 https://github.com/tylercarlson1 thanks for your input.

I usually use CreateMissingTypeMaps for things like Order -> OrderDto and Input -> Order (I don’t use the dto as an input), except for when I need to really configure something, at that point I do create a map. I find creating a map for each and every pair I want to map is extremely inconvenient since 90% of times the default mapping behavior will work.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AutoMapper/AutoMapper/issues/2181#issuecomment-312446367, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGYMoLekb-mjxyzU7-orXDyRjFgC4iNks5sJodegaJpZM4OLPhl .

0reactions
lock[bot]commented, May 6, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AutoMapper custom resolver does not work
So I used custom resolver with below code. IEnumerable<ActiveParticipant> activeParticipants = SomeMethod(); Mapper.CreateMap<ActiveParticipant, ...
Read more >
Custom Value Resolvers
We have several options in telling AutoMapper a custom value resolver to use, including: MapFrom<TValueResolver>; MapFrom(typeof(CustomValueResolver)); MapFrom( ...
Read more >
Jackson Exceptions - Problems and Solutions
This exception is thrown if Jackson can't access the constructor. In the following example, class User doesn't have a default constructor:
Read more >
Jackson JSON Java Parser API Example Tutorial
ObjectMapper is the most important class in Jackson API that provides readValue() and writeValue() methods to transform JSON to Java Object and ...
Read more >
Jackson - ObjectMapper Class
Customized TypeResolverBuilder that provides type resolver builders used with so-called "default typing" (see enableDefaultTyping() for details).
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