2

I am using Visual Studio 2015 with xUnit 2 with the Visual Studio test runner. I have this sample project that exhibits the following problem:

If I return string, Task<string> or MyObject from a method, the test appears in Test Explorer normally.

However, if I return Task<MyObject>, the test appears under an "External" category instead, and doesn't run when I click "Run Tests" in the editor.

Test explorer with a test under the "External" category

What could be causing this? I've found two Stack Overflow questions that sound similar, but they don't seem to apply:

Below is the information from Visual Studio's "About" page.

Microsoft Visual Studio Professional 2015 Version 14.0.25431.01 Update 3 Microsoft .NET Framework Version 4.6.01586

Installed Version: Professional

LightSwitch for Visual Studio 2015 00322-40000-00000-AA445 Microsoft LightSwitch for Visual Studio 2015

Microsoft Visual Studio Tools for Applications 2015
00322-40000-00000-AA445 Microsoft Visual Studio Tools for Applications 2015

Visual Basic 2015 00322-40000-00000-AA445 Microsoft Visual Basic 2015

Visual C# 2015 00322-40000-00000-AA445 Microsoft Visual C# 2015

Visual C++ 2015 00322-40000-00000-AA445 Microsoft Visual C++ 2015

Visual F# 2015 00322-40000-00000-AA445 Microsoft Visual F# 2015

Application Insights Tools for Visual Studio Package 7.17.00119.9 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 14.1.20907.0 ASP.NET and Web Tools 2015.1

ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0 For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013 5.2.40314.0 For additional information, visit http://www.asp.net/

Azure App Service Tools v2.8.1 14.0.11123.0 Azure App Service Tools v2.8.1

Breakpoint Generator 1.0 Automatically generate tracepoints for all the public entry points in your solution.

Common Azure Tools 1.8 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service 2.0 JavaScript Language Service

JavaScript Project System 2.0 JavaScript Project System

JetBrains ReSharper Ultimate 2016.1.2 Build 105.0.20160522.80219 JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2017 JetBrains, Inc.

Markdown Editor 1.10.186 A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.

Microsoft .NET Core Tools (Preview 2) 14.1.20907.0 Microsoft .NET Core Tools (Preview 2)

Microsoft Azure Mobile Services Tools 1.4 Microsoft Azure Mobile Services Tools

NuGet Package Manager 3.5.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer 1.2 Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Analysis Services 13.0.1700.68 Microsoft SQL Server Analysis Services Designer Version 13.0.1700.68

SQL Server Data Tools 14.0.60812.0 Microsoft SQL Server Data Tools

SQL Server Integration Services Microsoft SQL Server Integration Services Designer Version 13.0.1601.5

SQL Server Reporting Services 13.0.1700.68 Microsoft SQL Server Reporting Services Designers Version 13.0.1700.68

TargetFrameworkMigrator 1.0 Bulk Change .Net Projects Target Frameworks

TypeScript 1.8.36.0 TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps 14.0.25420.01 The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VsVim 2.2.0.0 VsVim is a Vim emulator for Visual Studio

Web Essentials 2015.3 3.0.235 Adds many useful features to Visual Studio for web developers. Requires Visual Studio 2015

Windows Installer XML Toolset 3.10.3.3007 Windows Installer XML Toolset version 3.10.3.3007 Copyright (c) .NET Foundation and contributors. All rights reserved.

Stephen Jennings
  • 12,494
  • 5
  • 47
  • 66

1 Answers1

0

I've also had several tests mysteriously labelled as "external" when using async Task<MyObject> calls. My workaround was to define MyObject inside the test assembly instead. Clearly this is not a solution for all cases, but it worked for me because I'm just de-serializing JSON data to POCO objects inside these problematic async function calls.

Tom Makin
  • 3,203
  • 23
  • 23