Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V8: Can't show list views for variant content on latest #5163

Closed
kjac opened this issue Apr 4, 2019 · 10 comments · Fixed by #5181
Closed

V8: Can't show list views for variant content on latest #5163

kjac opened this issue Apr 4, 2019 · 10 comments · Fixed by #5181

Comments

@kjac
Copy link
Contributor

kjac commented Apr 4, 2019

There's something funky going on. I have a culture variant content type with list view enabled. On latest source (d0b9fb7) this results in:

image

Removing the list view fixes the problem.

The error originates from the call to ContentController.GetChildren (http://localhost:8100/umbraco/backoffice/UmbracoApi/Content/GetChildren?id=1093&includeProperties=updateDate,owner&pageNumber=1&pageSize=2&orderBy=updateDate&orderDirection=Descending&orderBySystemField=true&filter=&cultureName=en-US). The controller action itself executes just fine, but when AngularJsonMediaTypeFormatter is tasked with writing the response, it throws the error shown above.

I'm pretty sure this error has been introduced within the last few days. That should narrow down the search for the bug 😄 I'd hunt for it myself but I'm at a loss as to why the ContentPropertyBasicMapper is invoked while writing the response.

Full stack trace of the inner exception

System.InvalidOperationException: No culture found in mapping operation when one is required for the culture variant property type heading
at Umbraco.Web.Models.Mapping.ContentPropertyBasicMapper1.Map(Property property, TDestination dest, MapperContext context) in D:\Projects\Umbraco-CMS-V8\src\Umbraco.Web\Models\Mapping\ContentPropertyBasicMapper.cs:line 63 at Umbraco.Web.Models.Mapping.ContentPropertyMapDefinition.Map(Property source, ContentPropertyBasic target, MapperContext context) in D:\Projects\Umbraco-CMS-V8\src\Umbraco.Web\Models\Mapping\ContentPropertyMapDefinition.cs:line 46 at Umbraco.Core.Mapping.UmbracoMapper.<>c__DisplayClass8_02.b__1(Object source, Object target, MapperContext context) in D:\Projects\Umbraco-CMS-V8\src\Umbraco.Core\Mapping\UmbracoMapper.cs:line 83
at Umbraco.Core.Mapping.UmbracoMapper.Map[TTarget](Object source, Type sourceType, MapperContext context) in D:\Projects\Umbraco-CMS-V8\src\Umbraco.Core\Mapping\UmbracoMapper.cs:line 187
at Umbraco.Core.Mapping.UmbracoMapper.Map[TTarget](Object source, MapperContext context) in D:\Projects\Umbraco-CMS-V8\src\Umbraco.Core\Mapping\UmbracoMapper.cs:line 135
at Umbraco.Core.Mapping.UmbracoMapper.Map[TTarget](Object source) in D:\Projects\Umbraco-CMS-V8\src\Umbraco.Core\Mapping\UmbracoMapper.cs:line 111
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) in //Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 677
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) in /
/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 179
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) in //Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 469
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) in /
/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 173
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) in //Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 703
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) in /
/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 179
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) in //Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 469
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty) in /
/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 173
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) in //Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs:line 95
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) in /
/Src/Newtonsoft.Json/JsonSerializer.cs:line 1149
at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)
at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)
at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content)
at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Umbraco.Web.WebApi.AngularJsonMediaTypeFormatter.d__1.MoveNext() in D:\Projects\Umbraco-CMS-V8\src\Umbraco.Web\WebApi\AngularJsonMediaTypeFormatter.cs:line 52
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.WebHost.HttpControllerHandler.d__22.MoveNext()

@Shazwazza
Copy link
Contributor

Thanks for reporting (vlatest) has done a lot of changes with how things are mapped so there must be a regression issue there. Will get this looked at!

@Shazwazza
Copy link
Contributor

Relates to #5087

@zpqrtbnk we'll need to look at this this sprint.

@kjac
Copy link
Contributor Author

kjac commented Apr 6, 2019

I found it while doing #5180 ... it's a fine mix of a missing mapping context and a LINQ evaluation of IEnumerable being performed when required (when writing the response) - the latter had me thrown off the trail. Anyway - PR in #5181

@zpqrtbnk
Copy link
Contributor

zpqrtbnk commented Apr 7, 2019

Have merged the PR but not entirely happy (see my note on the PR) about the context situation. It is way too error-prone.

So, re-opening the issue to try to find a better way.

@kjac
Copy link
Contributor Author

kjac commented Apr 7, 2019

Agreed. It works for now but let's see if there's a way to work around the potential context issue.

@zpqrtbnk
Copy link
Contributor

zpqrtbnk commented Apr 7, 2019

Want to have a look at PR #5182?

I think it's way safer this way: the context does just not expose the mapper at all, and is a mapper in itself, so if you need to nest mappings, you have to use the context.

@kjac
Copy link
Contributor Author

kjac commented Apr 7, 2019

Will give it a look in an hour or so when I can get to a computer 👍 but it sounds like the right approach.

@zpqrtbnk zpqrtbnk reopened this Apr 7, 2019
@zpqrtbnk
Copy link
Contributor

zpqrtbnk commented Apr 7, 2019

PR merged, keeping the issue open for a bit of testing, and then will close.

@kjac
Copy link
Contributor Author

kjac commented Apr 7, 2019

Looks good with the changes in #5182

@zpqrtbnk
Copy link
Contributor

zpqrtbnk commented Apr 7, 2019

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants