NullReferenceException thrown by test logger during build

martin.costello1's Avatar


02 Sep, 2018 02:35 PM

A NullReferenceException is occurring in a build of a project of mine when AppVeyor tries to upload the xunit test results:

This was causing the builds to fail until I changed the Powershell settings for my build script to ignore it.

AppVeyor should be correctly uploading the test results and not throwing an exception.

  1. 1 Posted by martin.costello... on 13 Sep, 2018 04:31 PM

    martin.costello1's Avatar

    This is also happening with a different project:

  2. Support Staff 2 Posted by Owen McDonnell on 13 Sep, 2018 08:38 PM

    Owen McDonnell's Avatar

    Sorry for the delay in responding. We have been trying to determine the cause of this error but haven't finished investigating. We haven't forgot.
    The additional project should be helpful in the investigation, thanks for that.

  3. Support Staff 3 Posted by Owen McDonnell on 20 Sep, 2018 05:04 PM

    Owen McDonnell's Avatar

    Can you try adding "parallelizeTestCollections": false to your xunit.runner.json file.

  4. 4 Posted by martin.costello... on 22 Sep, 2018 03:09 PM

    martin.costello1's Avatar

    I've changed this setting ( As it's intermittent, several builds over time will need to happen to see if that's the setting that's breaking things.

  5. 5 Posted by martin.costello... on 22 Sep, 2018 05:57 PM

    martin.costello1's Avatar
  6. Support Staff 6 Posted by Owen McDonnell on 22 Sep, 2018 10:05 PM

    Owen McDonnell's Avatar

    I added another setting "maxParallelThreads": 1 to that same file and had several (over 10) successful runs starting here.

    The one build error i did eventually get happens before the Testing function is even called in your Build.ps1, and seems to be an unrelated problem.

  7. 7 Posted by martin.costello... on 23 Sep, 2018 07:45 AM

    martin.costello1's Avatar
  8. 8 Posted by martin.costello... on 23 Sep, 2018 07:48 AM

    martin.costello1's Avatar

    Looks like this is coming from within xunit's built-in AppVeyor reporter:

  9. 9 Posted by martin.costello... on 23 Sep, 2018 08:09 AM

    martin.costello1's Avatar

    Have logged an issue with xunit here:

  10. 10 Posted by martin.costello... on 23 Sep, 2018 01:52 PM

    martin.costello1's Avatar

    After further investigation, root cause appears to be Application Insights:

  11. Support Staff 11 Posted by Owen McDonnell on 24 Sep, 2018 04:41 PM

    Owen McDonnell's Avatar

    Can you take a look at my build history and explain to me why every build of this commit fails with the original error for which this thread was created, while this commit, with the suggested changes, succeds.

  12. 12 Posted by martin.costello... on 24 Sep, 2018 04:52 PM

    martin.costello1's Avatar

    Changing those settings certainly seem to make it less likely to fail, but they don’t resolve the problem completely as I still had occasional failure after changing the settings.

    It seems like there’s an threading issue in Application Insights which causes something to be null, which then causes a NullRefenceException due to null not being checked for, which can then break HTTP calls made in the application. This also appears to be the likely cause of random errors I’m having with Selenium WebDriver.

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