Unable to upload images Object Reference not set to an instance


Hi guys,

I tried to upload a png file to cms through the asset pane.

Login --> Edit --> Asset Pane --> For All Sites --> Media --> Upload Files --> select the png file (2.8 KB) --> Failed with msg 'Object Reference not set to an instance'

Any advice would be appreciated.


Aug 25, 2022 12:28

Hi KK, The stack trace should hopefully show up in the logs to help you along.

Aug 25, 2022 13:13
KK - Aug 25, 2022 15:17
Thanks Surjit. Can I ask how to get the stack trace?
Surjit Bharath - Aug 25, 2022 15:56
Do you have a log writer setup? Look at the output logs?
If not, are you running kestrel? You'll be able to see the stack trace just after the error in the console where kestrel is running.

Are you getting the error on DXP? Take a look at live viewer on paasportal.

Have you got the Content Model setup to accept an png file. 


using EPiServer.Framework.DataAnnotations;
using ImagePointEditor;
using System.ComponentModel.DataAnnotations;

namespace Temp5.Models.Media;

[ContentType(GUID = "0A89E464-56D4-449F-AEA8-2BF774AB8730")]
[MediaDescriptor(ExtensionString = "jpg,jpeg,jpe,ico,gif,bmp,png")]
public class ImageFile : ImageData
    /// <summary>
    /// Gets or sets the copyright.
    /// </summary>
    /// <value>
    /// The copyright.
    /// </value>
    public virtual string Copyright { get; set; }

    [Display(Name = "Focal point")]
    public virtual string ImageFocalPoint { get; set; }

See here for documentation on the subject : Media types and templates (optimizely.com) 

Edited, Aug 25, 2022 13:52
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.