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.

Hardcoded timeout limit for dotnet command leads to problems with debugging

See original GitHub issue

Steps to reproduce:

  1. See that sometimes cyclonedx-dotnet returns Dotnet restore failed: and so can’t make result bom file
  2. In same case when run it pair with dotnet restore command everything is ok

Current result: dotnet restore is called inside cyclonedx-dotnet in DotnetUtilsService.cs

        public DotnetUtilsResult Restore(string path)
        {
            var arguments = "restore";
            if (!string.IsNullOrEmpty(path)) arguments = $"{arguments} \"{path}\"";

            var commandResult = _dotnetCommandService.Run(arguments);

            if (commandResult.Success)
            {
                return new DotnetUtilsResult();
            }
            else
            {
                return new DotnetUtilsResult
                {
                    // dotnet restore only outputs to std out, not std err
                    ErrorMessage = commandResult.StdOut
                };
            }
        }

If look on dotnetCommandService.Run

public DotnetCommandResult Run(string workingDirectory, string arguments)
        {
            var psi = new ProcessStartInfo(DotNetExe.FullPathOrDefault(), arguments)
            {
                CreateNoWindow = true,
                RedirectStandardOutput = true,
                RedirectStandardError = true,
                UseShellExecute = false,
                WorkingDirectory = workingDirectory
            };
            
            using (var p = Process.Start(psi))
            {
                var exitCode = 0;
                // ...
                var processExited = p.WaitForExit(60000);
                if (processExited)
                {
                    exitCode = p.ExitCode;
                }
                else
                {
                    p.Kill();
                    exitCode = -1;
                }
                // ...
                return result;
            }

Here we see hard-limit for 60 sec to call dotnet restore. It could be not enough in some cases, e.g. when you need to download 400+ heavyweight dependencies

Expected result:

  1. Add option for cyclonedx-dotnet to change this time limit
  2. Add error message to output about the limit passing event

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
coderpatroscommented, Jul 11, 2020

@oxdef closing this issue. It isn’t released yet. But will be in the next release.

1reaction
oxdefcommented, Jun 5, 2020

@coderpatros Thanks for the quick fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Timeouts with deployed code but not during debugging
When you use debugging mode, request time out is infinite but that is not the case when you are running it through published...
Read more >
Timeout While Debugging Web Services - Visual Studio ...
When you are stepping into an XML Web service from calling code, the call may sometimes time out, with the result being that...
Read more >
The mystery of session timeout in ASP.NET Core 3.1 & 5
Now hit F5 (not Ctrl+F5) to launch the application in debugging mode. Everything should work as before but you will see lots of...
Read more >
Worker Process startup timeout (30 sec) prevents reliably ...
When launching an azure function with func start --dotnet-isolated-debug , visual studio pauses for a period of time to allow you to attach ......
Read more >
Debugging a native deadlock in a .NET Linux application
That's because the tool has a hardcoded 4 minutes timeout, and the symbol server is very slow when accessed outside of the United...
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