Error while writing documentation - The filename, directory name, or volume label syntax is incorrect
tihomir-kit opened this issue · comments
Hi, I encountered this error recently:
Unhandled exception. System.Exception: Error while writing documentation for Hlix.Repository.LLBLGen.Repository<TEntity>.FetchEntitiesAsync(SD.LLBLGen.Pro.ORMSupportClasses.IRelationPredicateBucket, SD.LLBLGen.Pro.ORMSupportClasses.IPrefetchPath2, SD.LLBLGen.Pro.ORMSupportClasses.ISortExpression, System.Nullable<int>, SD.LLBLGen.Pro.ORMSupportClasses.IDataAccessAdapter)
---> System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Projects\Personal\Hlix\Hlix.Dox\Hlix.Repository.LLBLGen\doc\Hlix_Repository_LLBLGen_Repository_TEntity__FetchEntitiesAsync(SD_LLBLGen_Pro_ORMSupportClasses_IRelationPredicateBucket_SD_LLBLGen_Pro_ORMSupportClasses_IPrefetchPath2_SD_LLBLGen_Pro_ORMSupportClasses_ISortExpression_System_Nullable_int__SD_LLBLGen_Pro_ORMSupportClasses_IDataAccessAdapter).md'
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path)
at System.IO.File.WriteAllText(String path, String contents)
at DefaultDocumentation.Writer.MarkdownWriter.WritePage(DirectoryInfo directory, DocItem item) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\MarkdownWriter.cs:line 668
at DefaultDocumentation.Writer.DocItemWriter.Execute() in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\DocItemWriter.cs:line 112
--- End of inner exception stack trace ---
at DefaultDocumentation.Writer.DocItemWriter.Execute() in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\DocItemWriter.cs:line 116
at DefaultDocumentation.Generator.Execute(Settings settings) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Generator.cs:line 19
at DefaultDocumentation.Program.<>c.<Main>b__0_2(SettingsArgs a) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Console\Program.cs:line 33
at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
at DefaultDocumentation.Program.Main(String[] args) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Console\Program.cs:line 24
Unhandled exception. System.Exception: Error while writing documentation for Hlix.Repository.LLBLGen.Repository<TEntity>.FetchEntitiesAsync(SD.LLBLGen.Pro.ORMSupportClasses.IRelationPredicateBucket, SD.LLBLGen.Pro.ORMSupportClasses.IPrefetchPath2, SD.LLBLGen.Pro.ORMSupportClasses.ISortExpression, System.Nullable<int>, SD.LLBLGen.Pro.ORMSupportClasses.IDataAccessAdapter)
---> System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\Projects\Personal\Hlix\Hlix.Repository.LLBLGen\doc\Hlix_Repository_LLBLGen_Repository_TEntity__FetchEntitiesAsync(SD_LLBLGen_Pro_ORMSupportClasses_IRelationPredicateBucket_SD_LLBLGen_Pro_ORMSupportClasses_IPrefetchPath2_SD_LLBLGen_Pro_ORMSupportClasses_ISortExpression_System_Nullable_int__SD_LLBLGen_Pro_ORMSupportClasses_IDataAccessAdapter).md'
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path)
at System.IO.File.WriteAllText(String path, String contents)
at DefaultDocumentation.Writer.MarkdownWriter.WritePage(DirectoryInfo directory, DocItem item) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\MarkdownWriter.cs:line 668
at DefaultDocumentation.Writer.DocItemWriter.Execute() in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\DocItemWriter.cs:line 112
--- End of inner exception stack trace ---
at DefaultDocumentation.Writer.DocItemWriter.Execute() in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\DocItemWriter.cs:line 116
at DefaultDocumentation.Generator.Execute(Settings settings) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Generator.cs:line 19
at DefaultDocumentation.Program.<>c.<Main>b__0_2(SettingsArgs a) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Console\Program.cs:line 33
at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
at DefaultDocumentation.Program.Main(String[] args) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Console\Program.cs:line 24
It looks like this class (and specifically the method I included) are causing the problem:
namespace Hlix.Repository.LLBLGen
{
public class Repository<TEntity> : Repository, IRepository<TEntity> where TEntity : EntityBase2, IDbEntity, IEntity2, new()
{
protected readonly IRepositoryAdapter _repositoryAdapter;
public Repository(IRepositoryAdapter repositoryAdapter) : base(repositoryAdapter.DataAccessAdapter)
{
_repositoryAdapter = repositoryAdapter;
}
public async Task<IEnumerable<TEntity>> FetchEntitiesAsync(
IRelationPredicateBucket bucket,
IPrefetchPath2 prefetchPath,
ISortExpression sortExpression,
int? maxNumberOfItemsToReturn = null,
IDataAccessAdapter dataAccessAdapter = null)
{
var entityCollection = _repositoryAdapter.CollectionFactory<TEntity>();
await base.FetchEntitiesAsync(entityCollection, bucket, prefetchPath, sortExpression, maxNumberOfItemsToReturn, dataAccessAdapter);
return entityCollection.AsEnumerable();
}
// A bunch of other methods here
}
}
It could be due to a long file name that it generates (Git complained about the long filename) or the special characters. Any ideas? If you need more info, please let me know, and I'll provide whatever I can.
Thanks!
Another detail - when I remove the -u true
flag (IncludeUndocumentedItems), I don't get any errors. But it generates a different set of files then. Please see the visual Git diff of filenames:
(I would expect to see quite a bit more files being generated here btw, I assume the process just stopped when it encountered the error.)
it is probably indeed because of file name too long, see #57 (comment) you can change the naming strategy to produce shorter name, see if this solve your issue :)
Awesome, thanks for the quick reply. I switched to NameAndMd5Mix and have no more crashes now. Thnx!