This project is read-only.

My generic class gets StackOverflowException by MRefBuilder (v2.7.0.0)


My public generic class gets an unexpected error during build step in SHFB stating "Process is terminated due to StackOverflowException". I have attached the sample Visual Studio project in the attachment section below. Given the following code, whether MyClass is abstract or partial creates the error.
namespace MyClassLibrary
/// <summary>
/// MyClass Summary
/// </summary>
/// <typeparam name="TD"></typeparam>
/// <typeparam name="TT"></typeparam>
public abstract partial class MyClass<TD, TT>
    /// <summary>
    /// IBase Summary
    /// </summary>
    public interface IBase
        NestedClass<T> RequestElementsTyped<T>();
    /// <summary>
    /// NestedClass Summary
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class NestedClass<T> : IEquatable<NestedClass<T>>
        public bool Equals(NestedClass<T> other)
            throw new NotImplementedException();
    /// <summary>
    /// IAnother Summary
    /// </summary>
    public interface IAnother : IBase { }
Given build output:


[Sandcastle Help File Builder, version]

Creating output and working folders...

Clearing working folder...

Finding tools...
Found Sandcastle tools in 'C:\Program Files (x86)\Sandcastle\'
Searching for HTML Help 1 compiler...

Found HTML Help 1 compiler in 'C:\Program Files (x86)\HTML Help Workshop\'

Validating and copying documentation source information
Source: C:\Users\rdewan\Documents\Visual Studio 2010\Projects\ClassLibrary1\MyClassLibrary\bin\Debug\MyClassLibrary.dll
Found assembly 'C:\Users\rdewan\Documents\Visual Studio 2010\Projects\ClassLibrary1\MyClassLibrary\bin\Debug\MyClassLibrary.dll'

SHFB: Warning BE0062: No XML comments files found. The help file will not contain any member comments.

Generating shared content files (en-US, English (United States))...

Last step completed in 00:00:00.0040

Generating API filter for MRefBuilder...

Last step completed in 00:00:00.0010

Generating reflection information...
MRefBuilder (v2.7.0.0)
Copyright ¸ 2006-2012, Microsoft Corporation, All Rights Reserved
Info: Loaded 1 assemblies for reflection and 0 dependency assemblies.

Process is terminated due to StackOverflowException.
C:\Users\rdewan\Documents\Help\Working\GenerateRefInfo.proj(53,5): error MSB6006: "MRefBuilder.exe" exited with code -1073741571.

Last step completed in 00:00:25.2013

SHFB: Error BE0043: Unexpected error detected in last build step. See output above for details.

file attachments


EWoodruff wrote Jun 19, 2012 at 8:51 PM

I fixed one case where nested classes that reference other nested classes cause an endless loop. This is probably similar.

wrote Jul 24, 2012 at 9:33 AM

EWoodruff wrote Aug 7, 2012 at 8:19 PM

As I suspected, it was a similar issue to a case I'd already fixed. The nested type referencing itself was causing a stack overflow. I applied a similar fix to prevent it going too far and it will be in the next release.

wrote Feb 22, 2013 at 1:39 AM