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] Custom post processors are completely ignored by docfx #8740

Closed
Lulalaby opened this issue May 7, 2023 · 6 comments · Fixed by #8812
Closed

[BUG] Custom post processors are completely ignored by docfx #8740

Lulalaby opened this issue May 7, 2023 · 6 comments · Fixed by #8812
Labels
bug A bug to fix
Milestone

Comments

@Lulalaby
Copy link
Contributor

Lulalaby commented May 7, 2023

Hello there!

I'm in need of help for custom post processors.

I'm switching to the latest release rn and none of the post processors can be loaded anymore.

Can't import: CustomMemberIndexer, System.Composition.Hosting.CompositionFailedException: No export was found for the contract 'IPostProcessor "CustomMemberIndexer"'.
   at System.Composition.CompositionContext.GetExport(CompositionContract contract)
   at System.Composition.CompositionContext.GetExport(Type exportType, String contractName)
   at Microsoft.DocAsCode.Common.CompositionContainer.GetExport(CompositionHost container, Type type, String name) in /_/src/Microsoft.DocAsCode.Build.Engine/CompositionContainer.cs:line 50
Can't find the post processor: CustomMemberIndexer

Plugin Repo: https://github.com/Aiko-IT-Systems/DisCatSharp.DocFx.CustomMemberIndexer
Target Repo: https://github.com/Aiko-IT-Systems/DisCatSharp/tree/prep/release/10.4.0/DisCatSharp.Docs

What changed since the last releases (before the net6 upgrade).

I can't find any useful information in the releases, issues and docs.

Does the plugin needs to have a special name when generated?

I would be happy about any info pointing me in the right direction.

Regards Lala ❤️

debug.log

Note: It seems like it can find it when it's copied to the dotnet tools folder .dotnet/tools/.store/docfx/2.67.0/docfx/2.67.0/tools/net7.0/any/

@Lulalaby Lulalaby added the bug A bug to fix label May 7, 2023
@yufeih yufeih added this to the Backlog milestone May 8, 2023
@InFTord
Copy link
Contributor

InFTord commented May 8, 2023

Yes, local postprocessors currently don't work. I can try to fix it, but no promises.

@Lulalaby
Copy link
Contributor Author

Lulalaby commented May 8, 2023

Thank you! I'm going to look into it as well a bit, at least I try.

@Lulalaby
Copy link
Contributor Author

Lulalaby commented May 8, 2023

Ya it seems like the plugins for template folders are ignored completely.
Dunno how to fix tho

@Lulalaby Lulalaby changed the title Help with custom PostProcessor [BUG] Custom post processors are completely ignored by docfx May 8, 2023
@Lulalaby
Copy link
Contributor Author

Lulalaby commented May 8, 2023

The issue seems to be here:

private static readonly Assembly[] s_pluginAssemblies = LoadPluginAssemblies(AppContext.BaseDirectory).ToArray();

@AB0272C
Copy link

AB0272C commented May 17, 2023

Same issue. After I saw this in console
Searching custom plugins in directory C:\.....myProject....\bin\Debug\net6.0\...
I tried to add my post processor files to root folder and set <CopyToOutputDirectory>Always</CopyToOutputDirectory> for those files.
And it worked. So it searches files in bin/... folders, not in root

@filzrev
Copy link
Contributor

filzrev commented May 17, 2023

Current implementation seems DLL plugins are loaded from .exe exists directory only.

Additionary, LoadPluginAssemblies` methods loads unnecessary DLLs everytimes.

private static IEnumerable<Assembly> LoadPluginAssemblies(string pluginDirectory)

This behavihor can be confirms with following command.

docfx build --logLevel Verbose

In my environment, DLLs processing wasted about 500ms on every startup. (On Release build)


Related documents needs to fixed.

https://dotnet.github.io/docfx/tutorial/howto_build_your_own_type_of_documentation_with_custom_plug-in.html#enable-plug-in
https://dotnet.github.io/docfx/tutorial/howto_add_a_customized_post_processor.html#step4-build-your-project-and-copy-the-output-dll-files-to
https://dotnet.github.io/docfx/tutorial/advanced_support_hyperlink.html#test-and-verify

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

Successfully merging a pull request may close this issue.

5 participants