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

StaTheory is not supported in Visual Studio Runner #30

Closed
hughbe opened this issue Sep 23, 2019 · 13 comments · Fixed by #37
Closed

StaTheory is not supported in Visual Studio Runner #30

hughbe opened this issue Sep 23, 2019 · 13 comments · Fixed by #37

Comments

@hughbe
Copy link

hughbe commented Sep 23, 2019

Example

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;
using WinForms.Common.Tests;
using Xunit;

namespace System.Windows.Forms.Tests
{
    public class WebBrowserTests
    {
        public static IEnumerable<object[]> Parent_Set_TestData()
        {
           // yield return new object[] { null };
            yield return new object[] { new Control() };
        }

        [StaTheory]
        [MemberData(nameof(Parent_Set_TestData))]
        public void WebBrowser_Parent_Set_GetReturnsExpected(Control parent)
        {
            var browser = new WebBrowser
            {
                Parent = parent
            };
            Assert.Same(parent, browser.Parent);
            Assert.Null(browser.ActiveXInstance);
            Assert.False(browser.IsHandleCreated);
        }
    }
}
[9/23/2019 7:22:30.780 PM Informational] ---------- Discovery started ----------
[9/23/2019 7:22:33.339 PM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (32-bit Desktop .NET 4.0.30319.42000)
[9/23/2019 7:22:34.552 PM Informational] [xUnit.net 00:00:01.26]   Discovering: WinformsTest
[9/23/2019 7:22:35.854 PM Informational] [xUnit.net 00:00:02.40]   Discovered:  WinformsTest
[9/23/2019 7:22:35.855 PM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (32-bit Universal Windows)
[9/23/2019 7:22:36.060 PM Informational] ========== Discovery finished: 85 tests found (0:00:05.2286991) ==========
[9/23/2019 7:22:36.116 PM Informational] ---------- Run started ----------
[9/23/2019 7:22:38.520 PM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (32-bit Desktop .NET 4.0.30319.42000)
[9/23/2019 7:22:40.388 PM Error] [xUnit.net 00:00:01.88] WinformsTest: Test case System.Windows.Forms.Tests.WebBrowserTests.WebBrowser_Parent_SetWithHandle_GetReturnsExpected failed to deserialize: Test case deserialization failure: System.InvalidOperationException: Could not de-serialize type 'Xunit.Sdk.UITheoryTestCase' because it lacks a parameterless constructor.
   at Xunit.Serialization.XunitSerializationInfo.DeserializeSerializable(Type type, String serializedValue) in C:\Dev\xunit\xunit\src\common\XunitSerializationInfo.cs:line 213
   at Xunit.Serialization.XunitSerializationInfo.Deserialize(Type type, String serializedValue) in C:\Dev\xunit\xunit\src\common\XunitSerializationInfo.cs:line 110
   at Xunit.Sdk.SerializationHelper.Deserialize[T](String serializedValue) in C:\Dev\xunit\xunit\src\common\SerializationHelper.cs:line 40
   at Xunit.Sdk.XunitTestFrameworkExecutor.Deserialize(String value) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\XunitTestFrameworkExecutor.cs:line 84
   at Xunit.Sdk.TestCaseBulkDeserializer.Deserialize(ITestFrameworkDiscoverer discoverer, ITestFrameworkExecutor executor, String serialization) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\TestCaseBulkDeserializer.cs:line 33
[9/23/2019 7:22:40.390 PM Error] [xUnit.net 00:00:01.88] WinformsTest: Test case System.Windows.Forms.Tests.WebBrowserTests.WebBrowser_Parent_Set_GetReturnsExpected failed to deserialize: Test case deserialization failure: System.InvalidOperationException: Could not de-serialize type 'Xunit.Sdk.UITheoryTestCase' because it lacks a parameterless constructor.
   at Xunit.Serialization.XunitSerializationInfo.DeserializeSerializable(Type type, String serializedValue) in C:\Dev\xunit\xunit\src\common\XunitSerializationInfo.cs:line 213
   at Xunit.Serialization.XunitSerializationInfo.Deserialize(Type type, String serializedValue) in C:\Dev\xunit\xunit\src\common\XunitSerializationInfo.cs:line 110
   at Xunit.Sdk.SerializationHelper.Deserialize[T](String serializedValue) in C:\Dev\xunit\xunit\src\common\SerializationHelper.cs:line 40
   at Xunit.Sdk.XunitTestFrameworkExecutor.Deserialize(String value) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\XunitTestFrameworkExecutor.cs:line 84
   at Xunit.Sdk.TestCaseBulkDeserializer.Deserialize(ITestFrameworkDiscoverer discoverer, ITestFrameworkExecutor executor, String serialization) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\TestCaseBulkDeserializer.cs:line 33
[9/23/2019 7:22:40.416 PM Informational] [xUnit.net 00:00:01.89]   Starting:    WinformsTest
[9/23/2019 7:22:47.282 PM Informational] [xUnit.net 00:00:08.77]   Finished:    WinformsTest
[9/23/2019 7:22:47.807 PM Informational] ========== Run finished: 628 tests run (0:00:11.4979809) ==========
@AArnott
Copy link
Owner

AArnott commented Sep 25, 2019

What version are you using? When I open the xunit.stafact solution itself, it defines several StaTheory tests and they all run in the Test Explorer.

@Keboo
Copy link

Keboo commented Sep 30, 2019

I am running into the same issue with MaterialDesignInXaml.

xunit 2.4.1
xunit.runner.visualstudio 2.4.1
Xunit.StaFact 1.0.11-beta

Microsoft Visual Studio Enterprise 2019
Version 16.3.1
VisualStudio.16.Release/16.3.1+29324.140
Microsoft .NET Framework
Version 4.7.03190

Installed Version: Enterprise

Visual C++ 2019 00435-60000-00000-AA592
Microsoft Visual C++ 2019

ASP.NET and Web Tools 2019 16.3.283.64955
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 16.3.283.64955
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.3.283.64955
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 16.3.283.64955
Azure Functions and Web Jobs Tools

C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

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

Extensibility Message Bus 1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

GitHub.VisualStudio 2.10.6.8105
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.20816.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.0.83+gbc8a4b23ec
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 16.3.7 (9d260c5)
Support for debugging Mono processes with Visual Studio.

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

Project System Tools 1.0
Tools for working with C#, VisualBasic, and F# projects.

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Snapshot Debugging Extension 1.0
Snapshot Debugging Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.61908.27190
Microsoft SQL Server Data Tools

TypeScript Tools 16.0.10821.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823
Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 16.3.0.274 (d16-3@06531f8)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.3.0.230 (remotes/origin/d16-3-xcode11@bbe518670)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.3.565 (27e9746)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.0.0.43 (d16-3/8af1ca8)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Xamarin.iOS and Xamarin.Mac SDK 13.2.0.42 (5e8a208)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Diagnostic output as well:
[9/29/2019 9:33:23.846 PM Diagnostic] Enqueue operation 'RunSelectedOperation', hashcode:34013288
[9/29/2019 9:33:23.846 PM Diagnostic] Operation left in the the queue: 1
[9/29/2019 9:33:23.846 PM Diagnostic] 'RunSelectedOperation', hashcode:34013288
[9/29/2019 9:33:23.846 PM Diagnostic]

[9/29/2019 9:33:23.847 PM Diagnostic] Operation Dequeue : 'RunSelectedOperation'
[9/29/2019 9:33:24.161 PM Diagnostic] Starting programmatic build of containers...
[9/29/2019 9:33:24.349 PM Diagnostic] Completed programmatic build of containers.
[9/29/2019 9:33:24.350 PM Diagnostic] TestContainer update (build) complete : 189 ms
[9/29/2019 9:33:24.353 PM Diagnostic] DiscoveryOperation FinishedChangedCotainers, changed container count is 1
[9/29/2019 9:33:24.353 PM Diagnostic] Discovering the following containers :
[9/29/2019 9:33:24.353 PM Diagnostic] C:\Dev\MaterialDesignInXamlToolkit\MaterialDesignThemes.Wpf.Tests\bin\Debug\net452\MaterialDesignThemes.Wpf.Tests.dll
[9/29/2019 9:33:24.516 PM Informational] ---------- Discovery started ----------
[9/29/2019 9:33:24.519 PM Diagnostic] TelemetrySession: Creating the event: VS/UnitTest/TestWindow/Ext/RunSettingsService
[9/29/2019 9:33:24.519 PM Diagnostic] Event:VS/UnitTest/TestWindow/Ext/RunSettingsService key: VS.UnitTest.TestWindow.RunSettingsService.Name value:VSTest Run Configuration
[9/29/2019 9:33:24.520 PM Diagnostic] TelemetrySession: Creating the event: VS/UnitTest/TestWindow/Ext/RunSettingsService
[9/29/2019 9:33:24.520 PM Diagnostic] Event:VS/UnitTest/TestWindow/Ext/RunSettingsService key: VS.UnitTest.TestWindow.RunSettingsService.Name value:Fakes
[9/29/2019 9:33:24.520 PM Diagnostic] TelemetrySession: Creating the event: VS/UnitTest/TestWindow/Ext/RunSettingsService
[9/29/2019 9:33:24.520 PM Diagnostic] Event:VS/UnitTest/TestWindow/Ext/RunSettingsService key: VS.UnitTest.TestWindow.RunSettingsService.Name value:Dynamic Code Coverage
[9/29/2019 9:33:24.521 PM Diagnostic] File timestamp remains 9/29/2019 9:31:59 PM for C:\Dev\MaterialDesignInXamlToolkit\MaterialDesignThemes.Wpf.Tests\bin\Debug\net452\MaterialDesignThemes.Wpf.Tests.dll
[9/29/2019 9:33:24.521 PM Informational] ========== Discovery skipped: All test containers are up to date ==========
[9/29/2019 9:33:24.521 PM Diagnostic] TelemetrySession: Creating the event: VS/UnitTest/TestWindow/Ext/RunSettings
[9/29/2019 9:33:24.521 PM Diagnostic] Event:VS/UnitTest/TestWindow/Ext/RunSettings key: VS.UnitTest.TestWindow.RunSettings.Services value:3
[9/29/2019 9:33:24.566 PM Informational] ---------- Run started ----------
[9/29/2019 9:33:24.567 PM Diagnostic] TelemetrySession: Creating the event: VS/UnitTest/TestWindow/Ext/RunSettingsService
[9/29/2019 9:33:24.567 PM Diagnostic] Event:VS/UnitTest/TestWindow/Ext/RunSettingsService key: VS.UnitTest.TestWindow.RunSettingsService.Name value:VSTest Run Configuration
[9/29/2019 9:33:24.567 PM Diagnostic] TelemetrySession: Creating the event: VS/UnitTest/TestWindow/Ext/RunSettingsService
[9/29/2019 9:33:24.567 PM Diagnostic] Event:VS/UnitTest/TestWindow/Ext/RunSettingsService key: VS.UnitTest.TestWindow.RunSettingsService.Name value:Fakes
[9/29/2019 9:33:24.567 PM Diagnostic] TelemetrySession: Creating the event: VS/UnitTest/TestWindow/Ext/RunSettingsService
[9/29/2019 9:33:24.567 PM Diagnostic] Event:VS/UnitTest/TestWindow/Ext/RunSettingsService key: VS.UnitTest.TestWindow.RunSettingsService.Name value:Dynamic Code Coverage
[9/29/2019 9:33:24.568 PM Diagnostic] TelemetrySession: Creating the event: VS/UnitTest/TestWindow/Ext/RunSettings
[9/29/2019 9:33:24.568 PM Diagnostic] Event:VS/UnitTest/TestWindow/Ext/RunSettings key: VS.UnitTest.TestWindow.RunSettings.Services value:3
[9/29/2019 9:33:24.569 PM Diagnostic] Grouped C:\Dev\MaterialDesignInXamlToolkit\MaterialDesignThemes.Wpf.Tests\bin\Debug\net452\MaterialDesignThemes.Wpf.Tests.dll : (X86, Framework45, net452, )
[9/29/2019 9:33:24.572 PM Diagnostic] Tests run settings for C:\Dev\MaterialDesignInXamlToolkit\MaterialDesignThemes.Wpf.Tests\bin\Debug\net452\MaterialDesignThemes.Wpf.Tests.dll:


C:\Dev\MaterialDesignInXamlToolkit\TestResults
C:\Dev\MaterialDesignInXamlToolkit</SolutionDirectory>
X86
False

.
[9/29/2019 9:33:24.877 PM Diagnostic] UpdateSummary Detail Unchanged: SKIPPED
[9/29/2019 9:33:25.315 PM Diagnostic] UpdateSummary Detail Unchanged: SKIPPED
[9/29/2019 9:33:25.457 PM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (32-bit Desktop .NET 4.0.30319.42000)
[9/29/2019 9:33:26.056 PM Error] [xUnit.net 00:00:00.60] MaterialDesignThemes.Wpf.Tests: Test case MaterialDesignThemes.Wpf.Tests.TextBlockTests.DefaultVerticalAlignment_ShouldBeStretch failed to deserialize: Test case deserialization failure: System.InvalidOperationException: Could not de-serialize type 'Xunit.Sdk.UITheoryTestCase' because it lacks a parameterless constructor.
at Xunit.Serialization.XunitSerializationInfo.DeserializeSerializable(Type type, String serializedValue) in C:\Dev\xunit\xunit\src\common\XunitSerializationInfo.cs:line 213
at Xunit.Serialization.XunitSerializationInfo.Deserialize(Type type, String serializedValue) in C:\Dev\xunit\xunit\src\common\XunitSerializationInfo.cs:line 110
at Xunit.Sdk.SerializationHelper.Deserialize[T](String serializedValue) in C:\Dev\xunit\xunit\src\common\SerializationHelper.cs:line 40
at Xunit.Sdk.XunitTestFrameworkExecutor.Deserialize(String value) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\XunitTestFrameworkExecutor.cs:line 84
at Xunit.Sdk.TestCaseBulkDeserializer.Deserialize(ITestFrameworkDiscoverer discoverer, ITestFrameworkExecutor executor, String serialization) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\TestCaseBulkDeserializer.cs:line 33
[9/29/2019 9:33:26.064 PM Informational] [xUnit.net 00:00:00.61] Starting: MaterialDesignThemes.Wpf.Tests
[9/29/2019 9:33:26.153 PM Informational] [xUnit.net 00:00:00.70] Finished: MaterialDesignThemes.Wpf.Tests
[9/29/2019 9:33:26.362 PM Informational] ========== Run finished: 0 tests run (0:00:01.7739712) ==========
[9/29/2019 9:33:26.654 PM Diagnostic] UpdateSummary Detail Unchanged: SKIPPED
[9/29/2019 9:33:27.106 PM Diagnostic] UpdateSummary Detail Unchanged: SKIPPED

@RussKie
Copy link
Contributor

RussKie commented Oct 2, 2019

This consistently reproduces in https://github.com/dotnet/winforms

  1. Install .NET 5.0 sdk - https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-win-x64.exe
  2. Checkout 3750c43d5d9b5161be967e39fd848c89d6479ff5
  3. Open the solution in VS
  4. Run tests
  5. Observe the failure
[2/10/2019 12:07:04.830 PM Informational] ---------- Run started ----------
[2/10/2019 12:07:15.105 PM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (64-bit .NET Core 5.0.0-alpha1.19468.6)
[2/10/2019 12:07:15.881 PM Informational] [xUnit.net 00:00:00.79]   Starting:    System.Windows.Forms.Design.Editors.Tests
[2/10/2019 12:07:17.077 PM Informational] [xUnit.net 00:00:01.98]   Finished:    System.Windows.Forms.Design.Editors.Tests
[2/10/2019 12:07:17.757 PM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (64-bit .NET Core 5.0.0-alpha1.19468.6)
[2/10/2019 12:07:18.617 PM Informational] [xUnit.net 00:00:00.86]   Starting:    System.Windows.Forms.Design.Tests
[2/10/2019 12:07:20.132 PM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (64-bit .NET Core 5.0.0-alpha1.19468.6)
[2/10/2019 12:07:20.640 PM Informational] [xUnit.net 00:00:00.52]   Starting:    System.Windows.Forms.IntegrationTests
[2/10/2019 12:07:38.005 PM Informational] [xUnit.net 00:00:17.88]   Finished:    System.Windows.Forms.IntegrationTests
[2/10/2019 12:07:38.636 PM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (64-bit .NET Core 5.0.0-alpha1.19468.6)
[2/10/2019 12:07:39.229 PM Informational] [xUnit.net 00:00:00.60]   Starting:    System.Windows.Forms.Maui.IntegrationTests
[2/10/2019 12:07:45.286 PM Informational] [xUnit.net 00:00:06.66]   Finished:    System.Windows.Forms.Maui.IntegrationTests
[2/10/2019 12:07:47.473 PM Informational] [xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (64-bit .NET Core 5.0.0-alpha1.19468.6)
[2/10/2019 12:07:48.307 PM Warning] [xUnit.net 00:00:00.84] System.Windows.Forms.Tests: Catastrophic error during deserialization: System.InvalidOperationException: Could not de-serialize type 'Xunit.Sdk.UITheoryTestCase' because it lacks a parameterless constructor.
   at Xunit.Serialization.XunitSerializationInfo.DeserializeSerializable(Type type, String serializedValue) in C:\Dev\xunit\xunit\src\common\XunitSerializationInfo.cs:line 213
   at Xunit.Serialization.XunitSerializationInfo.Deserialize(Type type, String serializedValue) in C:\Dev\xunit\xunit\src\common\XunitSerializationInfo.cs:line 110
   at Xunit.Sdk.SerializationHelper.Deserialize[T](String serializedValue) in C:\Dev\xunit\xunit\src\common\SerializationHelper.cs:line 40
   at Xunit.Sdk.XunitTestFrameworkExecutor.Deserialize(String value) in C:\Dev\xunit\xunit\src\xunit.execution\Sdk\Frameworks\XunitTestFrameworkExecutor.cs:line 84
   at Xunit.DefaultTestCaseBulkDeserializer.<BulkDeserialize>b__2_0(String serialization) in C:\Dev\xunit\xunit\src\xunit.runner.utility\Descriptor\DefaultTestCaseBulkDeserializer.cs:line 22
   at System.Linq.Utilities.<>c__DisplayClass2_0`3.<CombineSelectors>b__0(TSource x)
   at System.Linq.Enumerable.SelectListIterator`2.ToList()
   at Xunit.DefaultTestCaseBulkDeserializer.BulkDeserialize(List`1 serializations) in C:\Dev\xunit\xunit\src\xunit.runner.utility\Descriptor\DefaultTestCaseBulkDeserializer.cs:line 22
   at Xunit.Xunit2.BulkDeserialize(List`1 serializations) in C:\Dev\xunit\xunit\src\xunit.runner.utility\Frameworks\v2\Xunit2.cs:line 75
   at Xunit.Runner.VisualStudio.VsTestRunner.RunTestsInAssembly(IRunContext runContext, IFrameworkHandle frameworkHandle, LoggerHelper logger, TestPlatformContext testPlatformContext, RunSettings runSettings, IMessageSinkWithTypes reporterMessageHandler, AssemblyRunInfo runInfo) in C:\Dev\xunit\xunit\src\xunit.runner.visualstudio\VsTestRunner.cs:line 562
[2/10/2019 12:07:48.316 PM Informational] [xUnit.net 00:00:00.85]   Starting:    System.Windows.Forms.Tests
[2/10/2019 12:07:48.352 PM Informational] [xUnit.net 00:00:00.88]   Finished:    System.Windows.Forms.Tests
[2/10/2019 12:07:48.937 PM Informational] ========== Run finished: 2455 tests run (0:00:44.0898446) ==========

@AArnott
Copy link
Owner

AArnott commented Oct 4, 2019

@RussKie I tried your repro, but couldn't get the solution to build. I get these errors:

1>------ Skipped Build: Project: Accessibility-version ------
1> 
2>------ Skipped Build: Project: InternalUtilitiesForTests ------
2> 
3>------ Skipped Build: Project: Microsoft.Dotnet.Winforms.ProjectTemplates ------
3> 
4>------ Skipped Build: Project: Accessibility (src\Accessibility\Accessibility) ------
4> 
5>------ Skipped Build: Project: System.Windows.Forms ------
5> 
6>------ Skipped Build: Project: System.Windows.Forms.Design.Editors ------
6> 
7>------ Build started: Project: System.Windows.Forms.IntegrationTests.Common, Configuration: Debug Any CPU ------
8>------ Skipped Build: Project: System.Windows.Forms.Tests ------
8> 
9>------ Build started: Project: AccessibilityTests, Configuration: Debug Any CPU ------
10>------ Skipped Build: Project: System.Windows.Forms.Design ------
10> 
11>------ Skipped Build: Project: System.Drawing.Design.Facade ------
11> 
12>------ Skipped Build: Project: System.Windows.Forms.Design.Editors.Tests ------
12> 
13>------ Skipped Build: Project: System.Design.Facade ------
13> 
14>------ Skipped Build: Project: System.Drawing.Facade ------
14> 
15>------ Skipped Build: Project: System.Windows.Forms.Design.Tests ------
15> 
16>------ Skipped Build: Project: Microsoft.Private.Winforms ------
16> 
7>CSC : error CS0006: Metadata file 'D:\git\winforms\artifacts\bin\Accessibility\Debug\netcoreapp5.0\Accessibility.dll' could not be found
7>CSC : error CS0006: Metadata file 'D:\git\winforms\artifacts\bin\System.Windows.Forms\Debug\netcoreapp5.0\ref\System.Windows.Forms.dll' could not be found
7>Done building project "System.Windows.Forms.IntegrationTests.Common.csproj" -- FAILED.
17>------ Skipped Build: Project: WinformsControlsTest ------
17> 
18>------ Skipped Build: Project: MauiButtonTests ------
18> 
19>------ Build started: Project: MauiComboBoxTests, Configuration: Debug Any CPU ------
20>------ Skipped Build: Project: System.Windows.Forms.IntegrationTests ------
20> 
19>CSC : error CS0006: Metadata file 'D:\git\winforms\artifacts\bin\Accessibility\Debug\netcoreapp5.0\Accessibility.dll' could not be found
19>CSC : error CS0006: Metadata file 'D:\git\winforms\artifacts\bin\System.Windows.Forms\Debug\netcoreapp5.0\ref\System.Windows.Forms.dll' could not be found
19>CSC : error CS0006: Metadata file 'D:\git\winforms\artifacts\bin\System.Windows.Forms.IntegrationTests.Common\Debug\netcoreapp5.0\System.Windows.Forms.IntegrationTests.Common.dll' could not be found
19>Done building project "MauiComboBoxTests.csproj" -- FAILED.
21>------ Skipped Build: Project: System.Windows.Forms.Maui.IntegrationTests ------
21> 
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error MSB4018: The "GenerateResource" task failed unexpectedly.
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error MSB4018: System.NullReferenceException: Object reference not set to an instance of an object.
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error MSB4018:    at Microsoft.Build.Tasks.ProcessResourceFiles.get_HaveSystemResourcesExtensionsReference()
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error MSB4018:    at Microsoft.Build.Tasks.ProcessResourceFiles.WriteBinaryResources(ReaderInfo reader, String filename)
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error MSB4018:    at Microsoft.Build.Tasks.ProcessResourceFiles.WriteResources(ReaderInfo reader, String filename)
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error MSB4018:    at Microsoft.Build.Tasks.ProcessResourceFiles.ProcessFile(String inFile, String outFileOrDir)
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error MSB4018:    at Microsoft.Build.Tasks.ProcessResourceFiles.Run(TaskLoggingHelper log, ITaskItem[] assemblyFilesList, List`1 inputs, List`1 satelliteInputs, List`1 outputs, Boolean sourcePath, Boolean usePreserializedResources, String language, String namespacename, String resourcesNamespace, String filename, String classname, Boolean publicClass, Boolean extractingResWFiles, String resWOutputDirectory)
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error MSB4018:    at Microsoft.Build.Tasks.GenerateResource.Execute()
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
9>C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3056,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
9>Done building project "AccessibilityTests.csproj" -- FAILED.
========== Build: 0 succeeded, 3 failed, 0 up-to-date, 18 skipped ==========

@RussKie
Copy link
Contributor

RussKie commented Oct 5, 2019 via email

@AArnott
Copy link
Owner

AArnott commented Oct 5, 2019

I was doing it from VS. Isn't that what the repro claims is failing? Are the tests not running within VS or from the command line?

Anyway, I'll try your script.

@RussKie
Copy link
Contributor

RussKie commented Oct 5, 2019 via email

@AArnott
Copy link
Owner

AArnott commented Oct 5, 2019

I installed the SDK already. And I am not fond of the fact that the script requires elevation. The problem with the build errors above isn't the lack of an SDK--it looks like build ordering to me.
I may spin up a Windows Sandbox to try this out since it requires elevation.

Is there any way the winforms repo can be fixed up so that it builds first time in VS without special steps? IMO nearly every .NET Core SDK based repo ought to be able to restore, build and test without elevation. I have this working, including .NET Core SDK installation in a user-location, over at https://github.com/aarnott/library.template.

@AArnott
Copy link
Owner

AArnott commented Oct 5, 2019

So I cloned the repo in a Windows Sandbox VM, installed the SDK and VS per your repro steps, and ran the build-local.ps1 script, which immediately failed.

.\build-local.ps1
System.Management.Automation.ItemNotFoundException: Cannot find path 'C:\Users\WDAGUtilityAccount\winforms\artifacts' because it does not exist.
   at System.Management.Automation.LocationGlobber.ExpandMshGlobPath(String path, Boolean allowNonexistingPaths, PSDriveInfo drive, ContainerCmdletProvider provider, CmdletProviderContext context)
   at System.Management.Automation.LocationGlobber.ResolveDriveQualifiedPath(String path, CmdletProviderContext context, Boolean allowNonexistingPaths, CmdletProvider& providerInstance)
   at System.Management.Automation.LocationGlobber.GetGlobbedMonadPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, CmdletProvider& providerInstance)
   at System.Management.Automation.LocationGlobber.GetGlobbedProviderPathsFromMonadPath(String path, Boolean allowNonexistingPaths, CmdletProviderContext context, ProviderInfo& provider, CmdletProvider& providerInstance)
   at System.Management.Automation.SessionStateInternal.GetChildItems(String path, Boolean recurse, UInt32 depth, CmdletProviderContext context)
   at Microsoft.PowerShell.Commands.GetChildItemCommand.ProcessRecord()

@AArnott
Copy link
Owner

AArnott commented Oct 5, 2019

Ironically, following that up with just msbuild successfully built the whole repo. Test Explorer then was able to run.

Good news: I can repro the problem. :)

@RussKie
Copy link
Contributor

RussKie commented Oct 5, 2019

Is there any way the winforms repo can be fixed up so that it builds first time in VS without special steps?

So far we couldn't find a good way. VS uses an sdk from the global dotnet folder, but we need a specific sdk installed locally (hence the elevation to create a symlink).
If you have any ideas how we could avoid that - please share. But the discussion is probably better had at the winforms repo.

@weltkante
Copy link

I think UITheoryTestCase is not usable in VS because it must be made serializable by implementing serialize and deserialize methods in addition to a adding a parameterless constructor?

RussKie added a commit to RussKie/Xunit.StaFact that referenced this issue Dec 5, 2019
The following test would not be executable:

    public class WebBrowserTests
    {
        public static IEnumerable<object[]> TestData()
        {
            yield return new object[] { null };
            yield return new object[] { new object() };
        }

        [StaTheory]
        [MemberData(nameof(TestData))]
        public void TheoryTest(object parent)
        {
            Assert.Null(parent);
        }
    }

The error message indicates that the test cannot be deserialised:

	Test case WebBrowserTests failed to deserialize: Test case deserialization failure: System.InvalidOperationException: Could not de-serialize type 'Xunit.Sdk.UITheoryTestCase' because it lacks a parameterless constructor.
	   at Xunit.Serialization.XunitSerializationInfo.DeserializeSerializable(Type type, String serializedValue)
	   at Xunit.Serialization.XunitSerializationInfo.Deserialize(Type type, String serializedValue)
	   at Xunit.Sdk.SerializationHelper.Deserialize[T](String serializedValue)
	   at Xunit.Sdk.XunitTestFrameworkExecutor.Deserialize(String value)
	   at Xunit.Sdk.TestCaseBulkDeserializer.Deserialize(ITestFrameworkDiscoverer discoverer, ITestFrameworkExecutor executor, String serialization)

Add serialisation plumbing to fix the issue.

Fixes AArnott#30
@RussKie
Copy link
Contributor

RussKie commented Dec 5, 2019

Thank you @weltkante, I believe your suggestion is right on the money - I was able to run WinForms' tests in VS with a little change.

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

Successfully merging a pull request may close this issue.

5 participants