Menu

#234 Documenter tries to create files with invalid characters

open
nobody
None
5
2005-03-07
2005-03-07
cbenien
No

Version of ndoc: 1.3.1
.NET Framework 1.1

We have a mix of c# and managed c++ assemblies in our
project. One of the C++ assemblies does some COM
interop for us for DirectShow access.

Now what happens is that some of the unmanaged types
also appear in the documenter. E.g. we get a namespace
called

ATL.?VTFromRegType@CRegParser@ATL@@$$FKAHPBDAAG@Z.__l2

The problem now is that some documenters try to save
this as .html file, and of course the question marks
are invalid. Sample exception message:

Exception: NDoc.Core.DocumenterException
at
NDoc.Documenter.NativeHtmlHelp2.NativeHtmlHelp2Documenter.Build(Project
project) in
D:\Solutions\NDoc_HDS\ndoc\src\Documenter\NativeHtmlHelp2\NativeHtmlHelp2Documenter.cs:line
272

at NDoc.Gui.BuildWorker.ThreadProc() in
D:\Solutions\NDoc_HDS\ndoc\src\Gui\BuildWorker.cs:line 63

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

at
NDoc.Documenter.NativeHtmlHelp2.Engine.HtmlFactory.TransformAndWriteResult(String
transformName, String fileName) in
D:\Solutions\NDoc_HDS\ndoc\src\Documenter\NativeHtmlHelp2\Engine\HtmlFactory.cs:line
276

at
NDoc.Documenter.NativeHtmlHelp2.Engine.HtmlFactory.MakeHtmlForInterfaceOrClassOrStructure(XmlNode
typeNode) in
D:\Solutions\NDoc_HDS\ndoc\src\Documenter\NativeHtmlHelp2\Engine\HtmlFactory.cs:line
371

at
NDoc.Documenter.NativeHtmlHelp2.Engine.HtmlFactory.MakeHtmlForTypes(String
namespaceName) in
D:\Solutions\NDoc_HDS\ndoc\src\Documenter\NativeHtmlHelp2\Engine\HtmlFactory.cs:line
335

at
NDoc.Documenter.NativeHtmlHelp2.Engine.HtmlFactory.MakeHtmlForNamespace(String
assemblyName, String namespaceName) in
D:\Solutions\NDoc_HDS\ndoc\src\Documenter\NativeHtmlHelp2\Engine\HtmlFactory.cs:line
312

at
NDoc.Documenter.NativeHtmlHelp2.Engine.HtmlFactory.MakeHtml()
in
D:\Solutions\NDoc_HDS\ndoc\src\Documenter\NativeHtmlHelp2\Engine\HtmlFactory.cs:line
250

at
NDoc.Documenter.NativeHtmlHelp2.NativeHtmlHelp2Documenter.MakeHtml(Workspace
workspace, HtmlFactory factory) in
D:\Solutions\NDoc_HDS\ndoc\src\Documenter\NativeHtmlHelp2\NativeHtmlHelp2Documenter.cs:line
346

at
NDoc.Documenter.NativeHtmlHelp2.NativeHtmlHelp2Documenter.Build(Project
project) in
D:\Solutions\NDoc_HDS\ndoc\src\Documenter\NativeHtmlHelp2\NativeHtmlHelp2Documenter.cs:line
237

I got the latest source code and implemented the
following function in
NativeHtmlHelp2\Engine\FileNameMapper.cs and used it on
all file names that the class can generate
(GetFileNameFor*)

private static readonly char[] invalidChars = {'<',
'>', '?', ':', '*', '/', '\\', '"', '|'};
private static string Checked(string path)
{
if (path.IndexOfAny(invalidChars) >= 0)
{
foreach (char invalidChar in invalidChars)
path = path.Replace(invalidChar, '_');
}
return path;
}

This allows me to compile the documentation. It would
be nice if something like this can be integrated in the
source code.

Thanks,
Christian

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.