U4-8103 - AutoMapper mapping types errors

Created by Jeroen Breuer 02 Mar 2016, 10:29:17 Updated by Claus Jensen 17 Jan 2017, 07:57:36

After upgrading multiple projects to Umbraco 7.4 we get mapping types errors in the backoffice. I'm not really what these errors are. I've added multiple errors as attachments.

Vorto 1.5 Content.txt I upgraded the [1-1 multilingual example|https://github.com/jbreuer/1-1-multilingual-example] to Vorto 1.5. After that I got this error on one of the content nodes.

NuCache Nested Content Datatype.txt I upgraded a large project to the 7.4 NuCache branch. When I try to open a datatype which has Nested Content I got this error.

NuCache Content.txt I upgraded a large project to the 7.4 NuCache branch. When I try to open some content nodes I got this error.

Upgrade DocumentType.txt Rasmus Fjord [upgraded from 7.3.4 to 7.4.1|https://our.umbraco.org/forum/core/general/75202-after-update-to-741-cant-access-nested-doctypes] and got this error on a document type.

Most of these upgrades are experimental and maybe the errors aren't related, but they are all about AutoMapper and mapping types.

4 Attachments

Download Vorto 1.5 Content.txt

Download NuCache Nested Content Datatype.txt

Download NuCache Content.txt

Download Upgrade DocumentType.txt

Comments

Jeroen Breuer 14 Mar 2016, 10:14:59

I see this is planned for sprint 11 which is this week and next week. Any chance this might make it into 7.4.2?


Shannon Deminick 14 Mar 2016, 13:18:09

@jbreuer can you please provide complete steps to reproduce from a new install?


Shannon Deminick 14 Mar 2016, 13:21:48

@zpqrtbnk the string[] one is actually a hidden exception and is due to the UrlProvider throwing an exception during mapping, i had this error in v8 and fixed it but it was just a symptom of a custom event handler throwing an exception, i'll try to dig up the details. The best thing we can do is surface the error in a better way since Automapper hides the inner exception.


Jeroen Breuer 14 Mar 2016, 13:37:32

@Shandem Sorry I don't have steps to reproduce from a new install. However you could download commit [b0b2daadb4aadb01ba49a4c078bb86e9f0b855e4|https://github.com/jbreuer/1-1-multilingual-example/commit/b0b2daadb4aadb01ba49a4c078bb86e9f0b855e4] of my 1-1 multilingual example (works out of the box with SqlCE). This commit is still using Vorto 1.4. If you upgrade it to Vorto 1.5 (not 1.5.1) and you open the Installing Modules node you should get the error which is also in the attachment.


Shannon Deminick 14 Mar 2016, 16:29:58

I guarantee this is an issue with an event handler in vorto then. I had code previously to replicate this issue and its due to an exception occurring during a mapping process and automapper hides the error. I'll try to dig up that code and we'll need to look at any event handlers in vorto


Jeroen Breuer 14 Mar 2016, 17:15:10

Yes it's an issue with Vorto. It's also fixed if you upgrade to Vorto 1.5.1. I just wanted to show that this error contained the mapping types part in the error message. It are probably all different errors and automapper hiding them explains why they all contain the mapping types part. So if automapper doesn't hide the error anymore it's easier to find the real bug and fix it.


Stephan 31 Mar 2016, 13:54:11

AutoMapper does not really "hide" the error, it is in the AutoMapperMappingException.InnerException. Only, it does not show in our custom YSOD panel, because the inner exception is not reported in the JSON returned by the server. Need to figure out how to ensure that the returned JSON contains the inner exception, so we actually can figure out what's causing the problem (and, I suspect, there might be a different cause for each of your 4 samples).


Jeroen Breuer 31 Mar 2016, 14:07:16

Yes the examples are all experiments so I'm positive that they have different causes.


Stephan 31 Mar 2016, 14:39:09

So, I have fixed our YSOD overlay so it displays the inner exceptions. I am very tempted to "just do this" and close the issue => each specific case can have its own issues with repro instructions and detailed inner exception trace. Thoughts?


Stephan 31 Mar 2016, 14:40:14

Will be PR: https://github.com/umbraco/Umbraco-CMS/pull/1210


Jeroen Breuer 31 Mar 2016, 14:54:53

I created this issue because all errors showed the same type of message. If the inner exceptions are displayed that will be fine and this issue can be closed. Most of the errors are from the NuCache branch so I won't create a new issue for those since it's WIP.


Stephan 31 Mar 2016, 16:01:11

OK - so here's the conclusion: moving this issue to "review" - the PR enables inner exception logging, and further inner errors will be logged as new issues.

Review: get the PR code, then modify eg ContentModelMapper so that .ForMember(dto => dto.Urls,...) throws an exception. Ensure that, when trying to edit a content, the AutoMapper exception is reported, along with the inner exception.


Shannon Deminick 31 Mar 2016, 16:37:15

works great!


Priority: Task - Pri 3

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.4.0, 7.4.1

Due in version: 7.4.3

Sprint: Sprint 12

Story Points:

Cycle: