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

Null reference exception processing test fail response #801

Closed
DavidKarlas opened this issue May 11, 2017 · 3 comments
Closed

Null reference exception processing test fail response #801

DavidKarlas opened this issue May 11, 2017 · 3 comments
Assignees
Labels

Comments

@DavidKarlas
Copy link
Member

Description

Null reference exception
at(most right are file and lines of stack trace)

vstest.console.exe!Microsoft.VisualStudio.TestPlatform.CommandLine.Internal.ConsoleLogger.GetFormattedOutput(System.Collections.ObjectModel.Collection<Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResultMessage> testMessageCollection = Count = 1) in /Users/davidkarlas/GIT/vstest/src/vstest.console/Internal/ConsoleLogger.cs:193
vstest.console.exe!Microsoft.VisualStudio.TestPlatform.CommandLine.Internal.ConsoleLogger.DisplayFullInformation(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestResult result = {TestCase    Failed   Message:   Expected: 3   But was:  4    StackTrace: at nunit24214asf.Test.TestCase () [0x00001] in <f8f163ea224243a98cc299290bc3bbab>:0    Test Messages: }) in /Users/davidkarlas/GIT/vstest/src/vstest.console/Internal/ConsoleLogger.cs:240
vstest.console.exe!Microsoft.VisualStudio.TestPlatform.CommandLine.Internal.ConsoleLogger.TestResultHandler(Microsoft.VisualStudio.TestPlatform.Common.Logging.InternalTestLoggerEvents sender = {Microsoft.VisualStudio.TestPlatform.Common.Logging.InternalTestLoggerEvents}, Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.TestResultEventArgs e = {Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging.TestResultEventArgs}) in /Users/davidkarlas/GIT/vstest/src/vstest.console/Internal/ConsoleLogger.cs:332

caused by response from NUnit adapter

{
  "Version": 2,
  "MessageType": "TestExecution.Completed",
  "Payload": {
    "TestRunCompleteArgs": {
      "TestRunStatistics": {
        "ExecutedTests": 1,
        "Stats": {
          "Failed": 1
        }
      },
      "IsCanceled": false,
      "IsAborted": false,
      "Error": null,
      "AttachmentSets": [],
      "ElapsedTimeInRunningTests": "00:00:00.6020462"
    },
    "LastRunTests": {
      "NewTestResults": [
        {
          "TestCase": {
            "Id": "029b14a7-ad86-b905-c51e-ddc6153502ae",
            "FullyQualifiedName": "nunit24214asf.Test.TestCase",
            "DisplayName": "TestCase",
            "ExecutorUri": "executor://NUnitTestExecutor",
            "Source": "/Users/davidkarlas/Projects/nunit24214asf/nunit24214asf/bin/Debug/nunit24214asf.dll",
            "CodeFilePath": null,
            "LineNumber": 0,
            "Properties": []
          },
          "Attachments": [],
          "Outcome": 2,
          "ErrorMessage": "  Expected: 3\n  But was:  4\n",
          "ErrorStackTrace": "at nunit24214asf.Test.TestCase () [0x00001] in <f8f163ea224243a98cc299290bc3bbab>:0\n",
          "DisplayName": "TestCase",
          "Messages": [
            {
              "Category": "StdOutMsgs",
              "Text": null
            }
          ],
          "ComputerName": "Davids-MacBook-Pro.local",
          "Duration": "00:00:00.0280000",
          "StartTime": "2017-05-11T11:37:51.326038+02:00",
          "EndTime": "2017-05-11T11:37:51.326045+02:00",
          "Properties": []
        }
      ],
      "TestRunStatistics": {
        "ExecutedTests": 1,
        "Stats": {
          "Failed": 1
        }
      },
      "ActiveTests": []
    },
    "RunAttachments": [],
    "ExecutorUris": [
      "executor://nunittestexecutor/"
    ]
  }
}

Steps to reproduce

I just executed test that had failure and it threw exception.

using NUnit.Framework;
using System;
namespace nunit24214asf
{
	[TestFixture()]
	public class Test
	{
		[Test()]
		public void TestCase()
		{
			Assert.AreEqual(3, 4);
		}
	}
}

Expected behavior

Either expect and handle null or change adapter/host(not sure which) to not send null for message text

Actual behavior

Null reference exception happens

Environment

This happened to me while I was implementing VSTest into VisualStudio for Mac and debugging vstest.console.exe built from master(commit sha1 9b92161).

@Faizan2304 Faizan2304 self-assigned this May 11, 2017
@Faizan2304 Faizan2304 added the bug label May 11, 2017
@Faizan2304
Copy link
Contributor

@DavidKarlas : Can you please share the nuget package version of Nunit adapter and the target framework version of your test project.
Seems like a bug in our side and willing to have a local repro.

@DavidKarlas
Copy link
Member Author

Whole configuration is still a bit in flux but I'm pretty sure Adapter is 2.0.0 and NUnit 2.6.4

@Faizan2304
Copy link
Contributor

Fixed!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants