1
Vote

BUG: Build error when building two methods with same signature but different use of capitals

description

Hi,

I got this error when building my documentation project:
Unexpected error while executing plug-in 'Lightweight Website Style': System.UnauthorizedAccessException: Access to the path 'path' is denied.

The log shows this:
<buildStep step="GenerateFullTextIndex">
Generating full-text index for the website...

<plugIn name="Lightweight Website Style" behavior="After" priority="1000">
Adding lightweight search and TOC elements to each topic...
</plugIn>
    Last step completed in 00:00:00.0780
</buildStep>
<buildStep step="Failed">

SHFB: Error BE0029: Unexpected error while executing plug-in 'Lightweight Website Style': System.UnauthorizedAccessException: Access to the path 'D:\Sandcastle Build\Working\Output\Website' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
   at System.IO.File.ReadAllText(String path, Encoding encoding)
   at SandcastleBuilder.PlugIns.LightweightWebsiteStylePlugIn.Execute(ExecutionContext context)
   at SandcastleBuilder.Utils.BuildEngine.BuildProcess.ExecutePlugIns(ExecutionBehaviors behavior)
   at SandcastleBuilder.Utils.BuildEngine.BuildProcess.ExecutePlugIns(ExecutionBehaviors behavior)
   at SandcastleBuilder.Utils.BuildEngine.BuildProcess.GenerateWebsite()
   at SandcastleBuilder.Utils.BuildEngine.BuildProcess.Build()
Access to the path 'D:\Sandcastle Build\Working\Output\Website' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
   at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
   at System.IO.File.ReadAllText(String path, Encoding encoding)
   at SandcastleBuilder.PlugIns.LightweightWebsiteStylePlugIn.Execute(ExecutionContext context)
   at SandcastleBuilder.Utils.BuildEngine.BuildProcess.ExecutePlugIns(ExecutionBehaviors behavior)

</buildStep>
After searching for a while I couldn't find an answer for my problem, so I decided to find the problem by excluding some projects.
I found the project that was triggering this error, so I started excluding some classes.
I found the class that was triggering this error and after excluding some methods I realised the problem.
It had something to do with the naming of my methods.

This was the problem:
/// <summary>
/// Documentation test class
/// </summary>
public class DocumentationClass
{
    //private
    // This method breaks the documentation project build
    private string doSomething(string action)
    {
        return action;
    }

    /// <summary>
    /// Do something
    /// </summary>
    /// <param name="action">action to do</param>
    /// <returns>Did something</returns>
    public string DoSomething(string action)
    {
        return doSomething(action);
    }
}
Apparently when I have two methods with the same signature but with the only difference in the use of lower- or uppercamelcase, the documentation project will fail building.

I suppose that this is a bug, because Visual Studio allows this.

I hope this will help someone else with the same problem.

comments

EWoodruff wrote Oct 26, 2014 at 7:02 PM

I'm unable to duplicate this problem. Using a test case with the code above, it works fine. Note that the error you got was an "Access denied" error on the folder. Perhaps a virus scanner was scanning the files as that has been known to cause similar issues.

And finally, for future questions or issues concerning Sandcastle or SHFB, post them over on the Sandcastle Help File Builder project's discussion page. You'll get a quicker response there. Thanks.

styros1013 wrote Dec 17, 2014 at 7:52 PM

I got the same "Access Denied" error, and it only happens when you set the Topic File Naming Method = "Member Name". If you use "GUID", it works fine. So, I'm assuming this has some error when translating method names into filenames.

EWoodruff wrote Dec 18, 2014 at 2:48 AM

Yes, that makes sense. "Member name" names the file just like it says. So, two members with the same name but differing case will cause a conflict since the OS doesn't care about case in filenames.