question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tool crashes on url timeout

See original GitHub issue

System.Threading.Tasks.TaskCanceledException: The request was canceled due to the configured HttpClient.Timeout of 10 seconds elapsing. —> System.TimeoutException: A task was canceled. —> System.Threading.Tasks.TaskCanceledException: A task was canceled. at System.Threading.Tasks.TaskCompletionSourceWithCancellation1.WaitWithCancellationAsync(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at System.Net.Http.HttpClient.HandleFailure(Exception e, Boolean telemetryStarted, HttpResponseMessage response, CancellationTokenSource cts, CancellationToken cancellationToken, CancellationTokenSource pendingRequestsCts) at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken) at NugetUtility.Methods.ExportLicenseTexts(List1 infos) in /home/runner/work/nuget-license/nuget-license/src/Methods.cs:line 1013 at NugetUtility.Program.Execute(PackageOptions options) in /home/runner/work/nuget-license/nuget-license/src/Program.cs:line 71


See line: https://github.com/tomchavakis/nuget-license/blob/cd15113781151dcce71af304d9ea48508dd8937b/src/Methods.cs#L976

I am using your tool for quite some time now, works great and helps me a lot! But now I ran into a problem that when there is a download timeout (export licenses) the application crashes. It would be nice when the execption is caught and logged. Now our build fails for difficult to troubleshoot error.

try…catch for the ExportLicenseTexts function ->
catch (TimeOutException ex) { WriteOutput($“Problem during download of License url: {fileToDownload} -> {ex.Message}”); }

Issue Analytics

  • State:closed
  • Created 8 months ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dbeusinkcommented, Feb 23, 2023

Can confirm it’s working as expected; both exception types are handled and logged. Log output:

Attempting to download: https://www.nuget.org/api/v2/package/coverlet.collector/3.2.0
Attempting to download https://licenses.nuget.org/MIT to C:\Temp\LicenseOut\coverlet.collector_3.2.0.txt
TaskCanceledException during download of license url https://licenses.nuget.org/MIT exception The operation was canceled.
Attempting to download: https://www.nuget.org/api/v2/package/coverlet.collector/3.2.0
Attempting to download https://licenses.nuget.org/MIT to C:\Temp\LicenseOut\coverlet.collector_3.2.0.txt
TaskCanceledException during download of license url https://licenses.nuget.org/MIT exception The operation was canceled.
Attempting to download: https://www.nuget.org/api/v2/package/fluentassertions/6.9.0
Attempting to download https://licenses.nuget.org/Apache-2.0 to C:\Temp\LicenseOut\FluentAssertions_6.9.0.txt
TaskCanceledException during download of license url https://licenses.nuget.org/Apache-2.0 exception The operation was canceled.
Attempting to download: https://www.nuget.org/api/v2/package/fluentassertions/6.9.0
Attempting to download https://licenses.nuget.org/Apache-2.0 to C:\Temp\LicenseOut\FluentAssertions_6.9.0.txt
TaskCanceledException during download of license url https://licenses.nuget.org/Apache-2.0 exception The operation was canceled.
Attempting to download: https://www.nuget.org/api/v2/package/microsoft.csharp/4.7.0
Attempting to download https://licenses.nuget.org/MIT to C:\Temp\LicenseOut\Microsoft.CSharp_4.7.0.txt
TaskCanceledException during download of license url https://licenses.nuget.org/MIT exception The operation was canceled.
Attempting to download: https://www.nuget.org/api/v2/package/microsoft.csharp/4.7.0
Attempting to download https://licenses.nuget.org/MIT to C:\Temp\LicenseOut\Microsoft.CSharp_4.7.0.txt
TaskCanceledException during download of license url https://licenses.nuget.org/MIT exception The operation was canceled.
Attempting to download: https://www.nuget.org/api/v2/package/microsoft.net.test.sdk/17.4.1
Attempting to download: https://www.nuget.org/api/v2/package/microsoft.tpl.dataflow/4.5.24
Attempting to download http://go.microsoft.com/fwlink/?LinkId=329770 to C:\Temp\LicenseOut\Microsoft.Tpl.Dataflow_4.5.24.txt
TaskCanceledException during download of license url http://go.microsoft.com/fwlink/?LinkId=329770 exception The operation was canceled.
Attempting to download https://raw.githubusercontent.com/moq/moq4/main/License.txt to C:\Temp\LicenseOut\Moq_4.18.4.txt
OperationCanceledException during download of license url https://raw.githubusercontent.com/moq/moq4/main/License.txt exception The operation was canceled.
Attempting to download: https://www.nuget.org/api/v2/package/xunit/2.4.2
Attempting to download https://licenses.nuget.org/Apache-2.0 to C:\Temp\LicenseOut\xunit_2.4.2.txt
TaskCanceledException during download of license url https://licenses.nuget.org/Apache-2.0 exception The operation was canceled.
Attempting to download: https://www.nuget.org/api/v2/package/xunit/2.4.2
Attempting to download https://licenses.nuget.org/Apache-2.0 to C:\Temp\LicenseOut\xunit_2.4.2.txt
TaskCanceledException during download of license url https://licenses.nuget.org/Apache-2.0 exception The operation was canceled.
Attempting to download: https://www.nuget.org/api/v2/package/xunit.runner.visualstudio/2.4.5```
1reaction
tomchavakiscommented, Feb 23, 2023

HI @dbeusink , Thank you for your suggestion. Maybe I will ask you to run one more test before merging to master.

Read more comments on GitHub >

github_iconTop Results From Across the Web

URL connection crashing app after timeout
I am developing an android app in which XML request is sent to server and response obtained is used in app for further...
Read more >
Troubleshoot Web Interface Timeouts
When you try to navigate to the Tableau Resource Monitoring Tool web interface, you see the following error: This can happen when the...
Read more >
Why is my app crashing with an R10 error?
R10 - Boot timeout errors occur when a web process took longer than 60 seconds to bind to its ... you may use...
Read more >
Fix AMD Driver Timeout Has Occurred Error Windows 11 & 10?
For detailed solutions and steps, visit our article - https://www.pcerror-fix.com/amd-driver- timeout Download the driver update tool ...
Read more >
RX 7900 xtx Timeout/Crashes : r/AMDHelp
Tested my RAM with the Windows 11 Tool. The result was has no issues. Games that Crashed: Elden Ring ( after few Hours)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found