Build error step 7 (Merge TOC)

Sep 12, 2008 at 10:05 PM
I'm getting this when I build my project:

Step 7 of 15: Merge TOC

Creating merged TOC file: C:\hhpdev\hhp\src\SW\SDK\SDKDocProject\buildhelp\merged_toc.xml

Step 7 System.NullReferenceException: Merge TOC:

Object reference not set to an instance of an object.

I've been messing with importing HTML topics to which I've added XML islands with the Topic Explorer. Now I'm getting the error above and even though I removed all imported topics I'm still getting the error. Any ideas? I have the working project in SVN so I can do some diffs.


Sep 12, 2008 at 10:11 PM

Never mind, I think I just found it. Somewhere in the editing a line

<topic />

was left in my topics.xml, perhaps by Topic Explorer. I don't remember putting it there myself. I took that line out and it's building again. Not sure how that line got there but thanks to SVN diff I was able to find it.




Sep 13, 2008 at 5:37 AM
Hi Andrew,

Glad that you fixed it.

Do you have any idea of what you may have been doing in Topic Explorer between your last successful build and when the empty topic element was added?  I'll need more information if I'm to reproduce and isolate the problem.

Sep 13, 2008 at 5:39 AM
BTW, I've made a note in my private TODO list to make sure that there's no exception when empty topic elements are encountered in case I don't found out what the real problem was.
Sep 14, 2008 at 2:56 AM
I tried reproducing it and it happened again. This is what I did:

- Start with a working DocProject that has a couple of managed projects as references and three MAML topics I created with Topic Explorer
- Import a bunch of HTML topic files
- Rearrange the topics to get the order I want

As you might remember, the topic files were previously generated from a fake managed project that had some C++ code in it. I removed the reference to that project and imported the HTML files into Topic Explorer so I can massage them to get the desired output. Not sure if that could have anything to do with it.

I can try it again to see if the same thing happens.

Sep 14, 2008 at 10:17 AM

Hi Andrew,

Thanks for the reply.  I'll play around with Topic Explorer to see if I can repro; dragging & dropping raw HTML topics sounds like it might have something to do with the problem.

- Dave

Sep 17, 2008 at 12:15 PM
Hi Andrew,

I can't reproduce the problem yet.  I started with an existing DocProject that had a MAML topic already in the TOC, imported 5 raw HTML topics and rearranged them using drag & drop in various ways.  After every one or two changes I tried saving and viewing the latest topics.xml file but there were never any empty topic nodes.  I then tried making a whole bunch of changes at once a couple of times but still the topics.xml file accurately reflected my changes.

About how many HTML files did you import and how many MAML topics do you have?  I'm just curious if maybe a huge number of files could cause the problem.
Also, how many changes do you think you made before saving and checking the topics.xml file?  Are we talking about 1 or 2, 10 to 20, or more like 50 to 100?

Maybe you can try to reproduce the problem again but this time only make one or two small changes at a time and click Save All after each.  If you leave the topics.xml file open then Visual Studio will ask you each time whether you want to load the changes to the file; click Yes to All.  Then examine the file for empty topic nodes and maybe you'll discover the operation in particular that causes the issue.

Sep 17, 2008 at 3:01 PM
Hi Dave,

I think I had two MAML topics and the root TOC topic when I imported about a dozen HTML files. When it started failing I reduced the number to only three or four and was still seeing the problem. There were also some interesting interactions between Topic Designer and topics.xml at the time. At one point all newly imported topics disappeared from Topic Desginer and reverted back to the previous state. I can't say for sure whether I had topics.xml open at the time (quite possible) so I'll chalk it up to not refreshing topics.xml in VS and then saving it back over the newer version.

I'll try to do the incremental import when I get a chance but right now it's stopped happening so I'd have to check out an earlier version from SVN first. My current version has around 50 HTML pages in addition to the reference topics and things are working great.

By the way, is there a way of splitting the reference topics of the three assemblies I'm documenting and making them child nodes of existing MAML topics?

Sep 17, 2008 at 4:20 PM
Hi Andrew,

As long as things are working for you now, and assuming that you mean Topic Explorer, not Topic Designer, I think I'll let this go until we can reproduce the problem.  It doesn't seem like a showstopper anyway :)

Note that if you have multiple DocProjects or DocSites in the same solution there is something to watch out for:  If you add topics to Topic Explorer, rearrange them, and then focus another project without saving the changes first, then your changes may be lost when Topic Explorer loads the content for the newly selected project.  To get around this just remember to click the Save All button before giving focus to another DocProject or DocSite in Solution Explorer.  This may be the cause of the "interesting interactions" that you witnessed between the Topic Explorer and the topics.xml file.

Currently there's no way to split the auto-generated TOC but I'm looking into it for the next release.  See this work item:

- Dave