1

We're implementing different Umbraco service using ApplicationContext to pull data from Umbraco backend. It always give null in return or gives exception of "Nullable object must have value" while calling the service method itself. This is might because of NULL in nodeUser column in umbracoNode table. If I update 0 in Database, my service runs fine. But it again sets nodeUser to NULL if I perform save in umbraco backend.

Here is my code :

var contentService = ApplicationContext.Current.Services.ContentService;

var contentTypeService = ApplicationContext.Current.Services.ContentTypeService;

var contentType = contentTypeService.GetContentType("blog");

var contents = contentService.GetContentOfContentType(contentType.Id);

Screenshot of Content

Can anyone help me to get out of this?

pirho
  • 11,565
  • 12
  • 43
  • 70
Developer
  • 46
  • 5
  • Can you provide a more complete example of the code that's throwing/returning the error? Those 4 lines alone aren't enough to get any context on the problem, and aren't likely to be the source of your problem. The `UserId` field can be null by design, so if you're accessing it and assuming it's not null this may be causing your problem. – Robert Foster Feb 18 '18 at 21:47
  • var contentType = contentTypeService.GetContentType("blog"); This is the line throwing/returning error. – Developer Feb 22 '18 at 05:57

1 Answers1

0

Upgrading the version of UmbracoCms.Core to the latest resolved the problem.

Developer
  • 46
  • 5