This project has moved and is read-only. For the latest updates, please go here.

NullReferenceException in BuildHelpTopics

Topics: Developer Forum, User Forum
Feb 6, 2007 at 8:29 AM
We get this exception when we build our documentation project using the SandcastleBuilderConsole.exe. Has anyone else seen this or know what is going on anyway?

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at SandcastleBuilder.Components.CodeBlockComponent.AddVS2005LanguageFilter(XmlNode title, XmlNode code, String language)
at SandcastleBuilder.Components.CodeBlockComponent.Apply(XmlDocument document, String key)
at Microsoft.Ddue.Tools.BuildAssembler.Apply(IEnumerable`1 manifest)
at Microsoft.Ddue.Tools.BuildAssembler.Apply(String manifestFile)
at Microsoft.Ddue.Tools.BuildAssemblerConsole.Main(String[] args)

thanx in advance

Feb 6, 2007 at 4:08 PM
Edited Feb 6, 2007 at 4:08 PM
There are a couple of bugs in the CodeBlockComponent in the release. It doesn't recognize some VB.NET preprocessor statements such as #Else If and #End If. It also can cause an exception if you have collapsible regions enabled and there are "<" or ">" characters in the region description. These have been fixed in the next release. A pre-release version is available in the Planned Releases section of the Releases tab ( Special). You can try that to see if it solves the problem. If not, please send me an example that duplicates the problem. Thanks.

Feb 6, 2007 at 9:57 PM
Thanks for the quick response. I will try to narrow down my project to find a simple repro of our problem. Since our projects are pure C# i guess the issues you are describing are not relevant to us.

I will report back as soon as I have a digestible repro.

Feb 7, 2007 at 10:22 AM
Edited Feb 7, 2007 at 10:28 AM
I have narrowed it down to the following linked code sample. If i remove the reference to this sample the project builds.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using EPiServer.BaseLibrary;
using Microsoft.Web.Services3.Addressing;
using Microsoft.Web.Services3.Messaging;
using log4net;
using EPiServer.Log.Core;

namespace CodeSamples
public class AnalyzerBaseSamples : AnalyzerBase
#region Initialize
public override void Initialize( System.Xml.XmlNode node )
// The base has to be initialized so the Config will work
base.Initialize( node );
// TODO: Put your initialize code here

public void DummyFunc()
if (1 > 0)
throw new Exception("Dummy Exception");
#region Log
catch (Exception ex)
Log.Error("This is a message on ERROR lever with trace", ex);

Since I'm responsible for our product build process and not an expert of the details of the documentation syntax I cannot really tell if there are any obious errors in the example code, but I would expect the tool to report something other than null reference exception.

Hope this helps

Feb 7, 2007 at 10:26 AM
Edited Feb 7, 2007 at 10:27 AM
Feb 7, 2007 at 3:55 PM
What are you using in the <code> tag to import the example? That will help me determine if it's a problem with the <code> tag itself or the example.

Feb 7, 2007 at 6:48 PM
I found it!

The reference to the example was defined as:

/// <code>
/// <code source="../Codesamples/EPiServer/Log/Core/AnalyzerBaseSamples.cs" region="Log" lang="cs"/>
/// </code>

with nested <code> elements. Removing the outer element makes the build succeed.

thanks for your input.