Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Angus 34 posts 128 karma points
    Mar 14, 2017 @ 14:34
    Angus
    0

    Creating Media Nodes Programatically -> NullReferenceException

    Hi,

    Following installation of Multiple Start Nodes, creation of media nodes programmatically using MediaService 'CreateMediaWithIdentity' gives rise to a NullReferenceException. Removing Multiple Start Nodes clears the problem.

    No issues creating nodes using ContentService 'CreateContentWithIdentity'.

    For example, logged in as administrator, existing target parent media node Id 14820...

    IMediaService mediaService = ApplicationContext.Current.Services.MediaService;
    IMedia extractedDocumentsFolder = mediaService.CreateMediaWithIdentity("New Node", 14820, "Folder"); 
    
    
    [NullReferenceException: Object reference not set to an instance of an object.]
       MultipleStartNodes.Events.UmbracoStartupEvent.MediaServiceSaving(IMediaService sender, SaveEventArgs`1 e) +27
       Umbraco.Core.Events.TypedEventHandler`2.Invoke(TSender sender, TEventArgs e) +0
       Umbraco.Core.Events.EventExtensions.IsRaisedEventCancelled(TypedEventHandler`2 eventHandler, TArgs args, TSender sender) +24
       Umbraco.Core.Services.MediaService.CreateMediaWithIdentity(String name, Int32 parentId, String mediaTypeAlias, Int32 userId) +283
    

    A

  • Dan White 206 posts 510 karma points c-trib
    Mar 14, 2017 @ 17:15
    Dan White
    0

    Hi Angus,

    What version of Umbraco are you running? I'll see what I can find.

    Thanks for reporting.

  • Dan White 206 posts 510 karma points c-trib
    Mar 14, 2017 @ 17:41
    Dan White
    100

    Angus,

    I found the issue and released a new version with the fix. Let me know if you still have any issues.

    Thanks!

  • Angus 34 posts 128 karma points
    Mar 14, 2017 @ 18:14
    Angus
    0

    Hi Dan,

    New version installed and working as expected (Umbraco v7.5.10). Impressive response!

    Thanks,

    Angus

Please Sign in or register to post replies

Write your reply to:

Draft