Copied to clipboard

Flag this post as spam?

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


  • Zar 5 posts 25 karma points
    Oct 16, 2012 @ 06:43
    Zar
    0

    NullReferenceException on newDocument(int)

    Hi,

    I’m trying to add some data from a spreadsheet to my umbraco nodes, the problem is when I try to go publish the nodes I’m getting a NullReferenceException inside the umbraco source. I had a look at the source code and I can’t figure it out, looks like a bug within Umbraco.

    I’m using Umbraco 4.8 and referencing 4.8 binaries. I tried with the 4.9 binaries but the same problem occurred.

    Here is the line with the issue, I checked that umbracoNodeId (=19437) is the correct ID for the node I was targeting first in the umbracoNode table of the database.

    var document = new Document(umbracoNodeId);

    Exception

    NullReferenceException was unhandled
    Object reference not set to an instance of an object. 

    Stack trace

       at umbraco.cms.businesslogic.CMSNode.setupNode()|
       at umbraco.cms.businesslogic.web.Document.setupNode()
       at umbraco.cms.businesslogic.CMSNode..ctor(Int32 Id)
       at umbraco.cms.businesslogic.Content..ctor(Int32 id)
       at umbraco.cms.businesslogic.web.Document..ctor(Int32 id)
       at ImportLocations.Program.UpdateReport(SqlConnection sqlConnection, ReportRow newData, Int32 umbracoNodeId)     at ImportLocations.Program.Import(String tsvFile, String server, String database, String user, String password)    at ImportLocations.Program.Main(String[] args) 

    CMSNode.setupNode source

    /// <summary>
    /// Sets up the internal data of the CMSNode, used by the various constructors
    /// </summary>
    protected virtual void setupNode()
    {
        using (IRecordsReader dr = SqlHelper.ExecuteReader(m_SQLSingle,
                SqlHelper.CreateParameter("@id", this.Id)))
        {
            if (dr.Read())
            {
                PopulateCMSNodeFromReader(dr);
            }
            else
            {
                throw new ArgumentException(string.Format("No node exists with id '{0}'", Id));
            }
        }
    }
Please Sign in or register to post replies

Write your reply to:

Draft