diff --git a/src/coverlet.collector/DataCollection/AttachmentManager.cs b/src/coverlet.collector/DataCollection/AttachmentManager.cs index 9a4a68786..9d847bb36 100644 --- a/src/coverlet.collector/DataCollection/AttachmentManager.cs +++ b/src/coverlet.collector/DataCollection/AttachmentManager.cs @@ -4,7 +4,6 @@ using System; using System.ComponentModel; using System.IO; -using coverlet.collector.Resources; using Coverlet.Collector.Utilities; using Coverlet.Collector.Utilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; @@ -109,7 +108,7 @@ private string SaveCoverageReport(string report, string reportFileName) } catch (Exception ex) { - string errorMessage = string.Format(Resources.FailedToSaveCoverageReport, CoverletConstants.DataCollectorName, reportFileName, _reportDirectory); + string errorMessage = $"{CoverletConstants.DataCollectorName}: Failed to save coverage report '{reportFileName}' in directory '{_reportDirectory}'"; throw new CoverletDataCollectorException(errorMessage, ex); } } @@ -168,8 +167,7 @@ private void CleanupReportDirectory() } catch (Exception ex) { - string errorMessage = string.Format(Resources.FailedToCleanupReportDirectory, CoverletConstants.DataCollectorName, _reportDirectory); - throw new CoverletDataCollectorException(errorMessage, ex); + throw new CoverletDataCollectorException($"{CoverletConstants.DataCollectorName}: Failed to cleanup report directory: '{_reportDirectory}'", ex); } } } diff --git a/src/coverlet.collector/DataCollection/CoverageManager.cs b/src/coverlet.collector/DataCollection/CoverageManager.cs index d6f6052c8..fa6bc9ab3 100644 --- a/src/coverlet.collector/DataCollection/CoverageManager.cs +++ b/src/coverlet.collector/DataCollection/CoverageManager.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using coverlet.collector.Resources; using Coverlet.Collector.Utilities; using Coverlet.Collector.Utilities.Interfaces; using Coverlet.Core; @@ -68,7 +67,7 @@ public void InstrumentModules() } catch (Exception ex) { - string errorMessage = string.Format(Resources.InstrumentationException, CoverletConstants.DataCollectorName); + string errorMessage = $"{CoverletConstants.DataCollectorName}: Failed to instrument modules"; throw new CoverletDataCollectorException(errorMessage, ex); } } @@ -96,7 +95,7 @@ private CoverageResult GetCoverageResult() } catch (Exception ex) { - string errorMessage = string.Format(Resources.CoverageResultException, CoverletConstants.DataCollectorName); + string errorMessage = $"{CoverletConstants.DataCollectorName}: Failed to get coverage result"; throw new CoverletDataCollectorException(errorMessage, ex); } } @@ -114,8 +113,7 @@ private CoverageResult GetCoverageResult() } catch (Exception ex) { - string errorMessage = string.Format(Resources.CoverageReportException, CoverletConstants.DataCollectorName); - throw new CoverletDataCollectorException(errorMessage, ex); + throw new CoverletDataCollectorException($"{CoverletConstants.DataCollectorName}: Failed to get coverage report", ex); } } } diff --git a/src/coverlet.collector/DataCollection/CoverletSettingsParser.cs b/src/coverlet.collector/DataCollection/CoverletSettingsParser.cs index 29584281e..733dacfcc 100644 --- a/src/coverlet.collector/DataCollection/CoverletSettingsParser.cs +++ b/src/coverlet.collector/DataCollection/CoverletSettingsParser.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; using System.Xml; -using coverlet.collector.Resources; using Coverlet.Collector.Utilities; namespace Coverlet.Collector.DataCollection @@ -72,8 +71,7 @@ private static string ParseTestModule(IEnumerable testModules) // Validate if at least one source present. if (testModules == null || !testModules.Any()) { - string errorMessage = string.Format(Resources.NoTestModulesFound, CoverletConstants.DataCollectorName); - throw new CoverletDataCollectorException(errorMessage); + throw new CoverletDataCollectorException($"{CoverletConstants.DataCollectorName}: No test modules found"); } // Note: diff --git a/src/coverlet.collector/InProcDataCollection/CoverletInProcDataCollector.cs b/src/coverlet.collector/InProcDataCollection/CoverletInProcDataCollector.cs index b61d75f55..b1e6c5be2 100644 --- a/src/coverlet.collector/InProcDataCollection/CoverletInProcDataCollector.cs +++ b/src/coverlet.collector/InProcDataCollection/CoverletInProcDataCollector.cs @@ -5,7 +5,6 @@ using System.Diagnostics; using System.Reflection; using System.Text; -using coverlet.collector.Resources; using Coverlet.Collector.Utilities; using Coverlet.Core.Instrumentation; using Microsoft.VisualStudio.TestPlatform.ObjectModel.DataCollection; @@ -76,8 +75,7 @@ public void TestSessionEnd(TestSessionEndArgs testSessionEndArgs) if (_enableExceptionLog) { _eqtTrace.Error("{0}: Failed to unload module with error: {1}", CoverletConstants.InProcDataCollectorName, ex); - string errorMessage = string.Format(Resources.FailedToUnloadModule, CoverletConstants.InProcDataCollectorName); - throw new CoverletDataCollectorException(errorMessage, ex); + throw new CoverletDataCollectorException($"{CoverletConstants.InProcDataCollectorName}: Failed to unload module", ex); } } } diff --git a/src/coverlet.collector/Resources/Resources.Designer.cs b/src/coverlet.collector/Resources/Resources.Designer.cs deleted file mode 100644 index b8dab181e..000000000 --- a/src/coverlet.collector/Resources/Resources.Designer.cs +++ /dev/null @@ -1,126 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace coverlet.collector.Resources { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("coverlet.collector.Resources.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to {0}: Failed to get coverage report. - /// - internal static string CoverageReportException { - get { - return ResourceManager.GetString("CoverageReportException", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0}: Failed to get coverage result. - /// - internal static string CoverageResultException { - get { - return ResourceManager.GetString("CoverageResultException", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0}: Failed to cleanup report directory: '{1}'. - /// - internal static string FailedToCleanupReportDirectory { - get { - return ResourceManager.GetString("FailedToCleanupReportDirectory", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0}: Failed to save coverage report '{1}' in directory '{2}'. - /// - internal static string FailedToSaveCoverageReport { - get { - return ResourceManager.GetString("FailedToSaveCoverageReport", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0}: Failed to unload module. - /// - internal static string FailedToUnloadModule { - get { - return ResourceManager.GetString("FailedToUnloadModule", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0}: Failed to instrument modules. - /// - internal static string InstrumentationException { - get { - return ResourceManager.GetString("InstrumentationException", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to {0}: No test modules found. - /// - internal static string NoTestModulesFound { - get { - return ResourceManager.GetString("NoTestModulesFound", resourceCulture); - } - } - } -} diff --git a/src/coverlet.collector/Resources/Resources.resx b/src/coverlet.collector/Resources/Resources.resx deleted file mode 100644 index af111547e..000000000 --- a/src/coverlet.collector/Resources/Resources.resx +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - {0}: Failed to get coverage report - - - {0}: Failed to get coverage result - - - {0}: Failed to cleanup report directory: '{1}' - - - {0}: Failed to save coverage report '{1}' in directory '{2}' - - - {0}: Failed to unload module - - - {0}: Failed to instrument modules - - - {0}: No test modules found - - \ No newline at end of file diff --git a/src/coverlet.collector/coverlet.collector.csproj b/src/coverlet.collector/coverlet.collector.csproj index 7b48b9a37..fc6145d80 100644 --- a/src/coverlet.collector/coverlet.collector.csproj +++ b/src/coverlet.collector/coverlet.collector.csproj @@ -49,33 +49,6 @@ - - - True - True - Resources.resx - - - True - True - Resources.resx - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - ResXFileCodeGenerator - Resource.Designer.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - - -