Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Removing a namespace generates a bug #9899

Closed
Patrick8639 opened this issue Apr 30, 2024 · 2 comments
Closed

[Bug] Removing a namespace generates a bug #9899

Patrick8639 opened this issue Apr 30, 2024 · 2 comments
Labels
bug A bug to fix

Comments

@Patrick8639
Copy link
Contributor

Describe the bug
I'm trying to document a project written using Avalonia UI. As the documentation is intended to be used by developers, internal and private members should be documented. To do this I added "disableDefaultFilter": "true" in the docfx.json file.
When compiling the application, a CompiledAvaloniaXaml namespace is created and I would like to remove it from documentation, so I added a filter.yml file and referenced it in the docfx.json file: "filter": "filter.yml". The filter file is a copy of the default filter in which I added the following.

  - exclude:
      uidRegex: '^CompiledAvaloniaXaml.*$'

When I generate the document, I have the following error:

D:\dotNet\Reversi\App\doc\api\CompiledAvaloniaXaml.yml: error ApplyTemplatePreprocessorError: Error transforming model "C:\Temp\docfx\rawmodel\api\CompiledAvaloniaXaml.raw.json" generated from "api/CompiledAvaloniaXaml.yml" using "ManagedReference.html.primary.js". Error running Transform function inside template preprocessor: Error: Cannot read property 'toLowerCase' of undefined
   at shouldHideTitleType (vm) ManagedReference.common.js:244:24
   at handleItem (vm, gitContribute, gitUrlPattern) ManagedReference.common.js:230:9
   at forEach ManagedReference.common.js:15:7
   at ManagedReference.common.js:14:5
DocumentException: Error transforming model "C:\Temp\docfx\rawmodel\api\CompiledAvaloniaXaml.raw.json" generated from "api/CompiledAvaloniaXaml.yml" using "ManagedReference.html.primary.js". Error running Transform function inside template preprocessor: Error: Cannot read property 'toLowerCase' of undefined
   at shouldHideTitleType (vm) ManagedReference.common.js:244:24
   at handleItem (vm, gitContribute, gitUrlPattern) ManagedReference.common.js:230:9
   at forEach ManagedReference.common.js:15:7
   at ManagedReference.common.js:14:5
     DocumentException: Error transforming model "C:\Temp\docfx\rawmodel\api\CompiledAvaloniaXaml.raw.json" generated from "api/CompiledAvaloniaXaml.yml" using "ManagedReference.html.primary.js". Error running Transform function inside template preprocessor: Error: Cannot read property 'toLowerCase' of     
     undefined
        at shouldHideTitleType (vm) ManagedReference.common.js:244:24
        at handleItem (vm, gitContribute, gitUrlPattern) ManagedReference.common.js:230:9
        at forEach ManagedReference.common.js:15:7
        at ManagedReference.common.js:14:5
          InvalidPreprocessorException: Error running Transform function inside template preprocessor: Error: Cannot read property 'toLowerCase' of undefined
             at shouldHideTitleType (vm) ManagedReference.common.js:244:24
             at handleItem (vm, gitContribute, gitUrlPattern) ManagedReference.common.js:230:9
             at forEach ManagedReference.common.js:15:7
             at ManagedReference.common.js:14:5
            at object TransformModel(object model) in PreprocessorWithResourcePool.cs:81
            at object TransformModel(object model) in Template.cs:95
            at ManifestItem Transform(InternalManifestItem item) in TemplateModelTransformer.cs:98
       at ManifestItem Transform(InternalManifestItem item) in TemplateModelTransformer.cs:115
       at void <ProcessCore>b__0(InternalManifestItem item) in TemplateProcessor.cs:194
       at void <RunAll>b__0(TElement s) in DocumentExceptionExtensions.cs:80
  at void RunAll<TElement>(IEnumerable<TElement> elements, Action<TElement> action, int parallelism) in DocumentExceptionExtensions.cs:89
  at void RunAll<TElement>(IReadOnlyList<TElement> elements, Action<TElement> action, int parallelism) in DocumentExceptionExtensions.cs:60
  at List<ManifestItem> ProcessCore(List<InternalManifestItem> items, ApplyTemplateSettings settings, IDictionary<string, object> globals) in TemplateProcessor.cs:189
  at List<ManifestItem> Process(List<InternalManifestItem> manifest, ApplyTemplateSettings settings, IDictionary<string, object> globals) in TemplateProcessor.cs:88
  at List<ManifestItem> ProcessTemplate() in ManifestProcessor.cs:182
  at void Process() in ManifestProcessor.cs:53
  at void Handle(List<HostService> hostServices, int maxParallelism) in LinkPhaseHandler.cs:32
  at Manifest Build(DocumentBuildParameters parameters, IMarkdownService markdownService) in SingleDocumentBuilder.cs:67
  at void Build(IList<DocumentBuildParameters> parameters, string outputDirectory) in DocumentBuilder.cs:124
  at void BuildDocument(BuildJsonConfig config, BuildOptions options, TemplateManager templateManager, string baseDirectory, string outputDirectory, string templateDirectory) in DocumentBuilderWrapper.cs:42
  at string Exec(BuildJsonConfig config, BuildOptions options, string configDirectory, string outputDirectory) in RunBuild.cs:39
  at void <Execute>b__0() in DefaultCommand.cs:51
  at int Run(LogOptions options, Action run) in CommandHelper.cs:48
  at int Execute(CommandContext context, Options options) in DefaultCommand.cs:31
  at Task<int> Execute(CommandContext context, CommandSettings settings) in CommandOfT.cs:40
  at Task<int> Execute(CommandTree leaf, CommandTree tree, CommandContext context, ITypeResolver resolver, IConfiguration configuration) in CommandExecutor.cs:144
  at async Task<int> Execute(IConfiguration configuration, IEnumerable<string> args) in CommandExecutor.cs:83
  at async Task<int> RunAsync(IEnumerable<string> args) in CommandApp.cs:84

Expected behavior
The documentation should compile.

Context (please complete the following information):

  • OS: Windows
  • Docfx version: 2.76.0
@Patrick8639 Patrick8639 added the bug A bug to fix label Apr 30, 2024
@filzrev
Copy link
Contributor

filzrev commented Apr 30, 2024

Is it able to provide Minimum reproduceable code?
I've tried to reproduced problems with Avalonia UI source code. But it can't reproduced.

As the documentation is intended to be used by developers, internal and private members should be documented. To do this I added "disableDefaultFilter": "true" in the docfx.json file.

disableDefaultFilter don't affect internal and private members.
Is it means includePrivateMembers?

uidRegex: '^CompiledAvaloniaXaml.*$'

I thought it need to escape . to \. (example)

@Patrick8639
Copy link
Contributor Author

Hello Filzrev,
Thank you for your answer.

I was annoyed for a couple of hours yesterday with this problem and setting disableDefaultFilter to false make it work at this time, so I really thought that was the problem. Ultimately, I changed the template and it was OK.
This morning, I tried to reproduce the problem, using a new simple project and the original one, and I can no more reproduce it.

I will close the issue and open another one if I have again this problem with test code.

Sorry to bother you with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug to fix
Projects
None yet
Development

No branches or pull requests

2 participants