DataTypeService.GetPreValueAsString throws InvalidOperationException (Sequence contains no matching elelement)
I'm using the DataTypeService to get the "nice text" (GetPreValueAsString) for a selected dropdownlist item. But on the first load of the website, I receive the following YSOD:
It looks as if something is not completely initialized when the call to the DataTypeService is invoked, because I only receive this message on the first run (after building). When I access the Umbraco backend in another page and then switch back to the actual page, the page loads just fine.
I should perhaps not that I'm using Zbu's ModelBuilder to generate strongtyped models for my document types (which works just fine).
DataTypeService.GetPreValueAsString throws InvalidOperationException (Sequence contains no matching elelement)
I'm using the DataTypeService to get the "nice text" (GetPreValueAsString) for a selected dropdownlist item. But on the first load of the website, I receive the following YSOD:
[InvalidOperationException: Sequence contains no matching element] System.Linq.Enumerable.Single(IEnumerable`1 source, Func`2 predicate) +621 Umbraco.Core.Persistence.Repositories.DataTypeDefinitionRepository.GetPreValueAsString(Int32 preValueId) +300 Umbraco.Core.Services.DataTypeService.GetPreValueAsString(Int32 id) +105
It looks as if something is not completely initialized when the call to the DataTypeService is invoked, because I only receive this message on the first run (after building). When I access the Umbraco backend in another page and then switch back to the actual page, the page loads just fine.
I should perhaps not that I'm using Zbu's ModelBuilder to generate strongtyped models for my document types (which works just fine).
A coworker of mine is periodically encountering this too. Umbraco 7.2.4. Not using Zbu's ModelBuilder.
Here's an Umbraco issue somebody submitted related to this: http://issues.umbraco.org/issue/U4-6289
I had a similar issue that I fixed by using this method instead umbraco.library.GetPreValueAsString
Woah. That fixed it for me, too...
is working on a reply...