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

WebServer serveDocs bug #225

Closed
halcwb opened this issue Jan 18, 2021 · 3 comments
Closed

WebServer serveDocs bug #225

halcwb opened this issue Jan 18, 2021 · 3 comments

Comments

@halcwb
Copy link
Contributor

halcwb commented Jan 18, 2021

Describe the bug
When running the watchdocs target I get the Application startup exception: System.ArgumentException: The path must be absolute. (Parameter 'root') error.

To Reproduce
Steps to reproduce the behavior:

  1. Install the latest mini-scaffold template
  2. Create a folder
  3. run the template
  4. run dotnet tool restore and dotnet fake build -t watchdocs

Expected behavior
Generated docs are serverd by the webserver

Desktop (please complete the following information):
.NET SDK (reflecting any global.json):
Version: 5.0.102
Commit: 71365b4d42

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.102\

Host (useful for support):
Version: 5.0.2
Commit: cb5f173b96

.NET SDKs installed:
2.1.801 [C:\Program Files\dotnet\sdk]
2.1.802 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
2.2.402 [C:\Program Files\dotnet\sdk]
3.1.102 [C:\Program Files\dotnet\sdk]
5.0.102 [C:\Program Files\dotnet\sdk]

Additional context
Error stack:

Application startup exception: System.ArgumentException: The path must be absolute. (Parameter 'root')
at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root)
at DocsTool.WebServer.startWebserver@64.Invoke(IApplicationBuilder app) in C:\Development\lab\MiniScaffold5\docsTool\WebServer.fs:line 65
at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass0_0.b__0(WebHostBuilderContext _, IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass2_1.b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.DelegateStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
Deleting directory C:\Users\halcw\AppData\Local\Temp\6de61e5a06b841d889c8ad41db932272
Deleting directory C:\Users\halcw\AppData\Local\Temp\76db36bfe8004c3cafad7e662fb909c5
Fatal error: System.ArgumentException: The path must be absolute. (Parameter 'root')
at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root)
at DocsTool.WebServer.startWebserver@64.Invoke(IApplicationBuilder app) in C:\Development\lab\MiniScaffold5\docsTool\WebServer.fs:line 65
at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass0_0.b__0(WebHostBuilderContext _, IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass2_1.b__2(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.DelegateStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHost.StartAsync(CancellationToken cancellationToken)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String startupMessage)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
at DocsTool.WebServer.startWebserver(FSharpEvent`1 refreshWebpageEvent, String docsDir, String url) in C:\Development\lab\MiniScaffold5\docsTool\WebServer.fs:line 61
at DocsTool.WebServer.serveDocs@104-5.Invoke(String url) in C:\Development\lab\MiniScaffold5\docsTool\WebServer.fs:line 104
at Program.main(String[] argv) in C:\Development\lab\MiniScaffold5\docsTool\Program.fs:line 449
watch : Exited with error code 1
watch : Waiting for a file to change before restarting dotnet...
Add any other context about the problem here.

@halcwb
Copy link
Contributor Author

halcwb commented Jan 18, 2021

Fixed by changing:

    let serveDocs refreshEvent docsDir =
        async {
            waitForPortInUse hostname port
            sprintf "http://%s:%d/index.html" hostname port |> openBrowser
        } |> Async.Start
        startWebserver refreshEvent docsDir (sprintf "http://%s:%d" hostname port)

Added the refreshEvent argument in WebServer.fs.

@halcwb halcwb changed the title Application startup exception: System.ArgumentException: The path must be absolute. (Parameter 'root') WebServer serveDocs bug Jan 18, 2021
@TheAngryByrd
Copy link
Owner

Fixed by changing:

    let serveDocs refreshEvent docsDir =
        async {
            waitForPortInUse hostname port
            sprintf "http://%s:%d/index.html" hostname port |> openBrowser
        } |> Async.Start
        startWebserver refreshEvent docsDir (sprintf "http://%s:%d" hostname port)

Added the refreshEvent argument in WebServer.fs.

Yeah I just encountered this over the weekend and didn’t fix it 🥲.

Mind sending a PR?

@TheAngryByrd
Copy link
Owner

Closed with #227

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

2 participants