From f75b45caec00e16206262b24ce6b5b3419371516 Mon Sep 17 00:00:00 2001 From: Vineeth Hanumanth <39301309+hvinett@users.noreply.github.com> Date: Wed, 11 Dec 2019 18:03:07 +0530 Subject: [PATCH] Eqt trace error was thrown if extension uri is not given (#2264) * eqttrace error was thrown if extension uri is not given * check for eqttrace error is enable or not * formatted --- .../Utilities/TestExtensionPluginInformation.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs index ec389d56ec..fd94f4f9c6 100644 --- a/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs +++ b/src/Microsoft.TestPlatform.Common/ExtensionFramework/Utilities/TestExtensionPluginInformation.cs @@ -67,7 +67,7 @@ public string ExtensionUri private static string GetExtensionUri(Type testLoggerType) { string extensionUri = string.Empty; - + object[] attributes = testLoggerType.GetTypeInfo().GetCustomAttributes(typeof(ExtensionUriAttribute), false).ToArray(); if (attributes != null && attributes.Length > 0) { @@ -79,6 +79,11 @@ private static string GetExtensionUri(Type testLoggerType) } } + if (EqtTrace.IsErrorEnabled && string.IsNullOrEmpty(extensionUri)) + { + EqtTrace.Error("The type \"{0}\" defined in \"{1}\" does not have ExtensionUri attibute.", testLoggerType.ToString(), testLoggerType.Module.Name); + } + return extensionUri; } }