.NET tests silently exiting on Ubuntu2204

Rob's Avatar


01 Apr, 2024 11:52 AM

Our test runs are sporadically only running about 830-840 tests from ~2950 and then returning with exit code 0, and reporting the job as successful on Ubuntu2204.


https://ci.appveyor.com/project/drieseng/ssh-net/builds/49520209 (bad)
https://ci.appveyor.com/project/drieseng/ssh-net/builds/49519909 (good)
https://ci.appveyor.com/project/drieseng/ssh-net/builds/49517420 (bad)
https://ci.appveyor.com/project/drieseng/ssh-net/builds/49517362 (bad, this one actually crashed)
https://ci.appveyor.com/project/drieseng/ssh-net/builds/49517250 (bad)
https://ci.appveyor.com/project/drieseng/ssh-net/builds/49517209 (good)

It seems to go back a couple of weeks. It may coincide with a change where we dropped the use of .NET SDK version 8.0.100 from apt-get in favour of the pre-loaded .NET 8 SDK (8.0.200) on the Ubuntu2204 image. However, the problem still exists when reinstating the apt-get for 8.0.203 (see also https://github.com/sshnet/SSH.NET/pull/1367)

Adding --verbosity to the dotnet test command shows no further detail other than "Build exited with code 0"

  1. 1 Posted by Rob on 01 Apr, 2024 11:55 AM

    Rob's Avatar

    The apt-get change from a few weeks ago was https://github.com/sshnet/SSH.NET/pull/1352

  2. Support Staff 2 Posted by Owen McDonnell on 02 Apr, 2024 04:39 PM

    Owen McDonnell's Avatar

    Current pre-installed version of .NET 8 on Ubuntu build images is 8.0.200-1. What happens if you skip the apt-get install?

  3. 3 Posted by Rob Hague on 02 Apr, 2024 05:57 PM

    Rob Hague's Avatar

    Apologies, I have found some much earlier examples than the SDK changes.

    The earliest I've found so far is

    Similarly, 840ish tests and then exit code 0 and job "successful"

  4. 4 Posted by Rob on 05 Apr, 2024 02:56 PM

    Rob's Avatar

    Update: I have narrowed it down to some very (unnecessarily) large arrays being allocated in the test code. After removing these, the jobs are stable.

    Presumably then, the process was crashing due to out-of-memory. But I cannot imagine why it had exit code 0?

  5. Support Staff 5 Posted by Owen McDonnell on 06 Apr, 2024 04:06 AM

    Owen McDonnell's Avatar

    It's likely the way that the build agent's custom powershell host is treating the error.
    You could put the test section into a powershell script (test_sript.ps1) with $ErrorActionPreference = "Stop" at the beginning of that script and call that from the testing section of your config and you should get a more predictable exit code.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac