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

Problem loading XML documentation on OS X #152

Open
tor-stangeland-bouvet opened this issue May 22, 2024 · 1 comment
Open

Problem loading XML documentation on OS X #152

tor-stangeland-bouvet opened this issue May 22, 2024 · 1 comment

Comments

@tor-stangeland-bouvet
Copy link

We have a custom tool that runs as part of our build process that uses Namotion.Reflection to extract the XML documentation. This runs fine on Windows and Linux, but on OS X the XML documentation file is not found.

Looking into the code I have found two bugs that should be handled:

  1. If running on OS X, using Assembly.Location folder is not done, only check for NuGet package is done. This is in XmlDocsExtensions.GetPathByOs() (
    private static string? GetPathByOs(dynamic? assembly, AssemblyName assemblyName)
    )
  2. The Assembly.CodeBase is handled differently on Windows where removing file:/// still results in an absolute path. While on Linux and OS X the first / (slash) is removed so that it becomes a relative address.
    if (ObjectExtensions.HasProperty(assembly, "CodeBase"))
    {
    var codeBase = (string)assembly.CodeBase;
    if (!string.IsNullOrEmpty(codeBase))
    {
    path = DynamicApis.PathCombine(DynamicApis.PathGetDirectoryName(codeBase
    .Replace("file:///", string.Empty)), assemblyName.Name + ".xml")
    .Replace("file:\\", string.Empty);
    if (DynamicApis.FileExists(path))
    {
    return path;
    }
    }
    }
@tor-stangeland-bouvet
Copy link
Author

Started working on a fix here: https://github.com/tor-stangeland-bouvet/Namotion.Reflection

Need to test a bit more on Linux and OS X before submitting a PR.

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

No branches or pull requests

1 participant