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

Adapter Failed to Load #958 #2156

Merged
merged 25 commits into from Sep 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
98cfefc
committing changes for #958 fix
DineshChirnanchu Sep 5, 2019
5081873
committing changes for #958 fix
DineshChirnanchu Sep 5, 2019
f7bb50c
committing tests fixes #958
DineshChirnanchu Sep 6, 2019
6b64b05
Merge remote-tracking branch 'upstream/master'
DineshChirnanchu Sep 6, 2019
0aab6d0
Merge branch 'master' into AdapterFailedToLoad
DineshChirnanchu Sep 6, 2019
3d2ceeb
commtting fixes for tests #958
DineshChirnanchu Sep 6, 2019
520272c
Updated handle class name and downgraded TestMessageLevel Error to Wa…
DineshChirnanchu Sep 10, 2019
1c938a4
Merge remote-tracking branch 'upstream/master'
DineshChirnanchu Sep 12, 2019
e89a48c
commit changes to print specific error messages in each case of adapt…
DineshChirnanchu Sep 12, 2019
65418b7
committing new tests for #958
DineshChirnanchu Sep 13, 2019
c291d2d
Code changes refined #958
DineshChirnanchu Sep 16, 2019
1fc1a8a
LogWarningOnNoTestsDiscovered change reverted
DineshChirnanchu Sep 16, 2019
40f5291
commit changes improve test results
DineshChirnanchu Sep 19, 2019
2b8895b
Merge branch 'master' of https://github.com/DineshChirnanchu/vstest
DineshChirnanchu Sep 19, 2019
8dbee95
commit latest changes
DineshChirnanchu Sep 19, 2019
0410144
commtting latest changes
DineshChirnanchu Sep 20, 2019
3e62089
Merge remote-tracking branch 'upstream/master'
DineshChirnanchu Sep 20, 2019
f6df00e
Merge branch 'master' into AdapterFailedToLoad
DineshChirnanchu Sep 20, 2019
afd4420
Reverted TestRunMessage handler unsubscription
DineshChirnanchu Sep 20, 2019
7211af9
Unsubscribed testRunMessage session
DineshChirnanchu Sep 20, 2019
6ab126a
latest changes
DineshChirnanchu Sep 20, 2019
c38ecae
Amendments have been done
DineshChirnanchu Sep 23, 2019
96f69f6
Format corrected
DineshChirnanchu Sep 25, 2019
da55993
Merge remote-tracking branch 'upstream/master'
DineshChirnanchu Sep 25, 2019
1868b1d
Merge branch 'master' into AdapterFailedToLoad
DineshChirnanchu Sep 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Microsoft.TestPlatform.Common/Constants.cs
Expand Up @@ -12,7 +12,7 @@ public static class TestPlatformDefaults
/// string in the vstest.console.exe.config that specifies the bound on no of jobs in the job queue.
/// </summary>
public const string MaxNumberOfEventsLoggerEventQueueCanHold = "MaxNumberOfEventsLoggerEventQueueCanHold";

/// <summary>
/// Default bound on the job queue.
/// </summary>
Expand Down
Expand Up @@ -7,14 +7,18 @@ namespace Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;

using System.Xml;
using Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.Utilities;
using Microsoft.VisualStudio.TestPlatform.Common.Logging;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers;
using Microsoft.VisualStudio.TestPlatform.Utilities.Helpers.Interfaces;
using CommonResources = Microsoft.VisualStudio.TestPlatform.Common.Resources.Resources;

/// <summary>
/// Discovers test extensions in a directory.
Expand All @@ -23,6 +27,8 @@ internal class TestPluginDiscoverer
{
private IFileHelper fileHelper;

private static List<string> UnloadableFiles = new List<string>();

/// <summary>
/// Initializes a new instance of the <see cref="TestPluginDiscoverer"/> class.
/// </summary>
Expand Down Expand Up @@ -128,6 +134,10 @@ private void AddKnownExtensions(ref IEnumerable<string> extensionPaths)
// Scan each of the files for data extensions.
foreach (var file in files)
{
if (UnloadableFiles.Contains(file))
{
continue;
}
try
{
Assembly assembly = null;
Expand All @@ -138,10 +148,16 @@ private void AddKnownExtensions(ref IEnumerable<string> extensionPaths)
this.GetTestExtensionsFromAssembly<TPluginInfo, TExtension>(assembly, pluginInfos);
}
}
catch (FileLoadException e)
{
EqtTrace.Warning("TestPluginDiscoverer-FileLoadException: Failed to load extensions from file '{0}'. Skipping test extension scan for this file. Error: {1}", file, e);
string fileLoadErrorMessage = string.Format(CultureInfo.CurrentUICulture, CommonResources.FailedToLoadAdapaterFile, file);
TestSessionMessageLogger.Instance.SendMessage(TestMessageLevel.Warning, fileLoadErrorMessage);
UnloadableFiles.Add(file);
}
catch (Exception e)
{
EqtTrace.Warning("TestPluginDiscoverer: Failed to load extensions from file '{0}'. Skipping test extension scan for this file. Error: {1}", file, e);
continue;
}
}
}
Expand All @@ -161,8 +177,8 @@ private void AddKnownExtensions(ref IEnumerable<string> extensionPaths)
{
Debug.Assert(assembly != null, "null assembly");
Debug.Assert(pluginInfos != null, "null pluginInfos");

Type[] types;

try
{
types = assembly.GetTypes();
Expand All @@ -178,7 +194,6 @@ private void AddKnownExtensions(ref IEnumerable<string> extensionPaths)
EqtTrace.Warning("LoaderExceptions: {0}", ex);
}
}

return;
}

Expand Down
Expand Up @@ -16,7 +16,7 @@ public interface IDiscoveryManager
/// Initializes the discovery manager.
/// </summary>
/// <param name="pathToAdditionalExtensions"> The path to additional extensions. </param>
void Initialize(IEnumerable<string> pathToAdditionalExtensions);
void Initialize(IEnumerable<string> pathToAdditionalExtensions, ITestDiscoveryEventsHandler2 eventHandler);

/// <summary>
/// Discovers tests
Expand Down
Expand Up @@ -18,7 +18,7 @@ public interface IExecutionManager
/// Initializes the execution manager.
/// </summary>
/// <param name="pathToAdditionalExtensions"> The path to additional extensions. </param>
void Initialize(IEnumerable<string> pathToAdditionalExtensions);
void Initialize(IEnumerable<string> pathToAdditionalExtensions, ITestMessageEventHandler testMessageEventsHandler);

/// <summary>
/// Starts the test run with sources.
Expand Down
14 changes: 11 additions & 3 deletions src/Microsoft.TestPlatform.Common/Resources/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Microsoft.TestPlatform.Common/Resources/Resources.resx
Expand Up @@ -153,6 +153,9 @@
<data name="FailedToFindInstalledUnitTestExtensions" xml:space="preserve">
<value>Failed to find the list of installed unit test extensions. Reason: {0}</value>
</data>
<data name="FailedToLoadAdapaterFile" xml:space="preserve">
<value>Failed to load extensions from file '{0}'. Please use /diag for more information.</value>
</data>
<data name="FastFilterException" xml:space="preserve">
<value>An error occured while creating Fast filter.</value>
</data>
Expand Down
Expand Up @@ -269,6 +269,11 @@
<target state="translated">Operace se ruší na základě žádosti.</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">Der Vorgang wird gemäß Anforderung abgebrochen.</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">La operación se cancelará como se ha solicitado.</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">Annulation de l'opération, comme demandé.</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">L'operazione verrà annullata come richiesto.</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">操作のキャンセルが要求されたため、キャンセルしています。</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">요청한 대로 작업을 취소하는 중입니다.</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">Anulowanie operacji zgodnie z żądaniem.</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">Cancelando a operação conforme solicitado.</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">Операция отменяется в соответствии с запросом.</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">İşlem istek üzerine iptal ediliyor.</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
5 changes: 5 additions & 0 deletions src/Microsoft.TestPlatform.Common/Resources/xlf/Resources.xlf
Expand Up @@ -146,6 +146,11 @@
<target state="new">Cancelling the operation as requested.</target>
<note></note>
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">按要求取消该操作。</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>
Expand Up @@ -269,6 +269,11 @@
<target state="translated">正在應要求取消作業。</target>
<note />
</trans-unit>
<trans-unit id="FailedToLoadAdapaterFile">
<source>Failed to load extensions from file '{0}'. Please use /diag for more information.</source>
<target state="new">TestPluginDiscoverer: Failed to load extensions from file '{0}'. Please use /diag for more information.</target>
<note></note>
</trans-unit>
</body>
</file>
</xliff>