Menu

#479 Can't generate documentation for classes that contain...

v1.3
open
nobody
5
2006-08-14
2006-08-14
No

Can't generate documentation for classes that contain
invalid DOS path chars. e.g. "< > : *" etc.

Environment:
NDoc 1.3.1 (GUI)
Net FW: 1.1
Documenter: MSDN

Step to reproduce:
1. Create file "2.cpp" with the following content:
#using <mscorlib.dll>
#include <vector>

using namespace System;
using namespace std;

public __gc class Test
{
void main()
{
vector< int > v(3);
v[0] = 0;
v[1] = 1;
v[2] = 2;

Console::WriteLine( v[0] );
}
};
2. Compile it using VS 2003. Run cl.exe /clr /MD /LD
2.cpp /link /NOENTRY nochkclr.obj
3. Start NDoc GUI, add generated 2.dll to assembly
list and start document building process.

Expected:
Process is successfully finished.

In fact: following exception raised:
- Message:
An error occured while trying to build the
documentation.

Exception: NDoc.Core.DocumenterException
Illegal characters in path.

Exception: System.ArgumentException
Illegal characters in path.

- Stack trace:
Exception: NDoc.Core.DocumenterException
at
NDoc.Documenter.Msdn.MsdnDocumenter.Build(Project
project)

at NDoc.Gui.BuildWorker.ThreadProc()

Exception: System.ArgumentException
at System.IO.Path.Combine(String path1, String
path2)

at
NDoc.Documenter.Msdn.MsdnDocumenter.TransformAndWriteResult(String
transformName, XsltArgumentList arguments, String
filename)

at
NDoc.Documenter.Msdn.MsdnDocumenter.MakeHtmlForInterfaceOrClassOrStructure(WhichType
whichType, XmlNode typeNode)

at
NDoc.Documenter.Msdn.MsdnDocumenter.MakeHtmlForTypes(String
namespaceName)

at
NDoc.Documenter.Msdn.MsdnDocumenter.MakeHtmlForNamespace(String
assemblyName, String namespaceName)

at
NDoc.Documenter.Msdn.MsdnDocumenter.MakeHtmlForAssembliesSorted()

at
NDoc.Documenter.Msdn.MsdnDocumenter.Build(Project
project)

------------------
I proposu you add following function to
Core.PathUtilities
/// <summary>
/// Escapes incorrect DOS path chars
/// </summary>
/// <param name="fileName">String that
contains filename</param>
/// <returns>Quoted string</returns>
public static string QuoteFilePath( string
fileName )
{
StringBuilder b = new StringBuilder(
fileName.Length );
foreach( char i in fileName )
{
if(
i >= 'a' && i <= 'z' ||
i >= 'A' && i <= 'Z' ||
i >= '0' && i <= '9' ||
i >= '!' && i <= ')' ||
i >= '+' && i <= '.' ||
i == '-' ||
i == '_'
)
b.Append( i );
else
b.Append( "%" +
((int)i).ToString("X") );
}

return b.ToString();
}

and use it in all GetFilenameForXXXX members.

Thanks for advance.
With best regards
Ujos.

Discussion


Log in to post a comment.