NullReferenceException in BuildHelpTopics

Topics: Developer Forum, User Forum
Feb 6, 2007 at 7: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

Fredrik
Coordinator
Feb 6, 2007 at 3:08 PM
Edited Feb 6, 2007 at 3:08 PM
There are a couple of bugs in the CodeBlockComponent in the 1.3.3.1 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 (1.3.4.0 Special). You can try that to see if it solves the problem. If not, please send me an example that duplicates the problem. Thanks.

Eric
Feb 6, 2007 at 8: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.

Fredrik
Feb 7, 2007 at 9:22 AM
Edited Feb 7, 2007 at 9: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
}
#endregion

public void DummyFunc()
{
try
{
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);
}
#endregion
}
}
}

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

.f
Feb 7, 2007 at 9:26 AM
Edited Feb 7, 2007 at 9:27 AM
Coordinator
Feb 7, 2007 at 2: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.

Eric
Feb 7, 2007 at 5: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.

.f