Automapper: Mapping of Expression<Func<T,bool>> causes exception starting from AutoMapper 5.2.0

Created on 4 Jan 2017  路  13Comments  路  Source: AutoMapper/AutoMapper

Starting from AutoMapper version 5.2.0 we can't execute mapped queries anymore. Exception is "Additional information: variable 'r' of type 'OmmitedDTOModel3.EntityDTO1' referenced from scope '', but it is not defined". In production code we are using EF so execution of EF query results in exception "The parameter 'r' was not bound in the specified LINQ to Entities query expression". AutoMapper 5.1.1 works fine, as well as versions 4

I made a repro:
https://github.com/vukispasic/AutoMapperExpressionMappingIssue.

Bug

All 13 comments

Can you try the MyGet Build?

Already tried, same issue

https://github.com/AutoMapper/AutoMapper/commit/b22ce56ac64a7a2d2ccd2ecb8ef69302c6cee63e#diff-51fc29521ce7d80eddd4a9ef366b9d09R300 Here's the problem most likely. I'm guessing it needs to get replaced with IsAssignableFrom, because it only fails on Id in your repo, which is a property inherited from the base entity class.

Are you planning to implement this in next nightly build?

Feel free to submit a PR if you want it fixed faster!

Thank you

Hello. I fixed the issue as TylerCarlson1 proposed. I also created unit test. How can I publish from my local branch and make pull request? I get 403 (Forbidden). Thanks

You have to fork the repository in github and push the branch there. Then from that remote branch you can request a PR on github

Sent from my iPhone

On Jan 14, 2017, at 1:32 PM, vukispasic <[email protected]notifications@github.com> wrote:

Hello. I fixed the issue as TylerCarlson1 proposed. I also created unit test. How can I publish from my local branch and make pull request? I get 403 (Forbidden). Thanks

-
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/AutoMapper/AutoMapper/issues/1886#issuecomment-272647246, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGfIgNHeMVxV25R_HzYOZr3YoKe4lRK5ks5rSSK6gaJpZM4Laj0T.

I made pull request https://github.com/AutoMapper/AutoMapper/pull/1911 as instructed

Hi @jbogard, when are we going to release in nuget.org

I see this marked as closed, but I am still seeing this behavior when I run a release build with the Optimize Code build configuration set to true. Can you please confirm this is truly closed? If so, I would recommend testing again with the Optimize Code option set to true.

@cjrogala A repro would help. Make a gist that we can execute and see fail.

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.

Was this page helpful?
0 / 5 - 0 ratings