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

Adding Microsoft.VisualStudio.ArchitectureTools.PEReader.dll to Extensions #2041

Merged
merged 4 commits into from
Jun 6, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding E2E test
  • Loading branch information
vagisha-nidhi committed Jun 4, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 2cd6e572110808c01e8d614faa04e15d72154ad5
13 changes: 13 additions & 0 deletions test/Microsoft.TestPlatform.AcceptanceTests/DataCollectionTests.cs
Original file line number Diff line number Diff line change
@@ -82,6 +82,19 @@ public void ExecuteTestsWithDataCollectionUsingCollectArgument(RunnerInfo runner
this.VaildateDataCollectorOutput();
}

[TestMethod]
[NetFullTargetFrameworkDataSource]
[NetCoreTargetFrameworkDataSource]
public void DataCollectorAssemblyLoadingShouldNotThrowError(RunnerInfo runnerInfo)
{
AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo);

var arguments = PrepareArguments(GetAssetFullPath("TraceCollectorLoader.dll", "netcoreapp2.0"), string.Empty, string.Empty, this.FrameworkArgValue);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding only netcoreapp2.0 since AppDomain is only available after netcoreapp2.0.
Documentation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this run for net451 then ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And where is the datacollector getting enabled, I need to understand this better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We load the datacollectors only in the case of netcore as this change was made only in DotnetTestHostManager here. So net451 run without error.
var allAssemblies = AppDomain.CurrentDomain.GetAssemblies(); in the test loads datacollectors including the trace datacollector.
When we attempt to get the types of the trace datacollector, in var typeInfo = assembly.GetTypes(); it breaks with the error.


this.InvokeVsTest(arguments);
this.ValidateSummaryStatus(1, 0, 0);
}

private static void CreateDataCollectionRunSettingsFile(string destinationRunsettingsPath, Dictionary<string, string> dataCollectionAttributes)
{
var doc = new XmlDocument();
Original file line number Diff line number Diff line change
@@ -348,6 +348,11 @@ protected string GetAssetFullPath(string assetName)
return this.testEnvironment.GetTestAsset(assetName);
}

protected string GetAssetFullPath(string assetName, string targetFramework)
{
return this.testEnvironment.GetTestAsset(assetName, targetFramework);
}

protected string GetTestAdapterPath(UnitTestFramework testFramework = UnitTestFramework.MSTest)
{
string adapterRelativePath = string.Empty;
6 changes: 6 additions & 0 deletions test/TestAssets/TestAssets.sln/TestAssets.sln
Original file line number Diff line number Diff line change
@@ -45,6 +45,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LegacySettingsUnitTestProje
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NewtonSoftDependency", "..\NewtonSoftDependency\NewtonSoftDependency.csproj", "{79EDA259-5EA0-45F0-990A-F078427E198A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TraceCollectorLoader", "..\TraceCollectorLoader\TraceCollectorLoader.csproj", "{85A7A75D-3FFE-4F9E-B71A-E4CF83D8E8E6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -135,6 +137,10 @@ Global
{79EDA259-5EA0-45F0-990A-F078427E198A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79EDA259-5EA0-45F0-990A-F078427E198A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79EDA259-5EA0-45F0-990A-F078427E198A}.Release|Any CPU.Build.0 = Release|Any CPU
{85A7A75D-3FFE-4F9E-B71A-E4CF83D8E8E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85A7A75D-3FFE-4F9E-B71A-E4CF83D8E8E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85A7A75D-3FFE-4F9E-B71A-E4CF83D8E8E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85A7A75D-3FFE-4F9E-B71A-E4CF83D8E8E6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
15 changes: 15 additions & 0 deletions test/TestAssets/TraceCollectorLoader/TraceCollectorLoader.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net451</TargetFrameworks>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="MSTest.TestAdapter" Version="1.3.1" />
<PackageReference Include="MSTest.TestFramework" Version="1.3.1" />
</ItemGroup>

</Project>
24 changes: 24 additions & 0 deletions test/TestAssets/TraceCollectorLoader/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;

namespace TraceCollectorLoader
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the project is slightly misleading. Rename it to what is actually doing, something related to GetAssemblies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
// https://github.com/microsoft/vstest/issues/2008
// GetAssemblies adds datacollectors to test host appdomain which was failing in the above issue

var allAssemblies = AppDomain.CurrentDomain.GetAssemblies();

foreach(var assembly in allAssemblies)
{
var typeInfo = assembly.GetTypes();
}
}
}
}