diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs
index 102ef6551b..e9c987d108 100644
--- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs
+++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs
@@ -8,7 +8,7 @@ using Microsoft.CodeAnalysis.Host.Mef;
namespace Microsoft.CodeAnalysis.Razor
{
[Shared]
- [ExportWorkspaceServiceFactory(typeof(ErrorReporter))]
+ [ExportWorkspaceServiceFactory(typeof(ErrorReporter), ServiceLayer.Default)]
internal class DefaultErrorReporterFactory : IWorkspaceServiceFactory
{
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
diff --git a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/Resources.Designer.cs b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/Resources.Designer.cs
new file mode 100644
index 0000000000..1afd67a924
--- /dev/null
+++ b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/Resources.Designer.cs
@@ -0,0 +1,58 @@
+//
+namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor
+{
+ using System.Globalization;
+ using System.Reflection;
+ using System.Resources;
+
+ internal static class Resources
+ {
+ private static readonly ResourceManager _resourceManager
+ = new ResourceManager("Microsoft.VisualStudio.Mac.LanguageServices.Razor.Resources", typeof(Resources).GetTypeInfo().Assembly);
+
+ ///
+ /// Razor Language Service error encountered.
+ ///
+ internal static string RazorLanguageServiceGeneralError
+ {
+ get => GetString("RazorLanguageServiceGeneralError");
+ }
+
+ ///
+ /// Razor Language Service error encountered.
+ ///
+ internal static string FormatRazorLanguageServiceGeneralError()
+ => GetString("RazorLanguageServiceGeneralError");
+
+ ///
+ /// Razor Language Service error encountered from project '{0}'.
+ ///
+ internal static string RazorLanguageServiceProjectError
+ {
+ get => GetString("RazorLanguageServiceProjectError");
+ }
+
+ ///
+ /// Razor Language Service error encountered from project '{0}'.
+ ///
+ internal static string FormatRazorLanguageServiceProjectError(object p0)
+ => string.Format(CultureInfo.CurrentCulture, GetString("RazorLanguageServiceProjectError"), p0);
+
+ private static string GetString(string name, params string[] formatterNames)
+ {
+ var value = _resourceManager.GetString(name);
+
+ System.Diagnostics.Debug.Assert(value != null);
+
+ if (formatterNames != null)
+ {
+ for (var i = 0; i < formatterNames.Length; i++)
+ {
+ value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
+ }
+ }
+
+ return value;
+ }
+ }
+}
diff --git a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Resources.resx b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Resources.resx
new file mode 100644
index 0000000000..b62fd544ab
--- /dev/null
+++ b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Resources.resx
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ Razor Language Service error encountered.
+
+
+ Razor Language Service error encountered from project '{0}'.
+
+
\ No newline at end of file
diff --git a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporter.cs b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporter.cs
new file mode 100644
index 0000000000..5cf0a05c77
--- /dev/null
+++ b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporter.cs
@@ -0,0 +1,40 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Diagnostics;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.Razor;
+using MonoDevelop.Core;
+
+namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor
+{
+ internal class VisualStudioErrorReporter : ErrorReporter
+ {
+ public override void ReportError(Exception exception)
+ {
+ if (exception == null)
+ {
+ Debug.Fail("Null exceptions should not be reported.");
+ return;
+ }
+
+ LoggingService.LogError(
+ Resources.RazorLanguageServiceGeneralError,
+ exception);
+ }
+
+ public override void ReportError(Exception exception, Project project)
+ {
+ if (exception == null)
+ {
+ Debug.Fail("Null exceptions should not be reported.");
+ return;
+ }
+
+ LoggingService.LogError(
+ Resources.FormatRazorLanguageServiceProjectError(project?.Name),
+ exception);
+ }
+ }
+}
diff --git a/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs
new file mode 100644
index 0000000000..779cd87a54
--- /dev/null
+++ b/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs
@@ -0,0 +1,20 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System.Composition;
+using Microsoft.CodeAnalysis.Host;
+using Microsoft.CodeAnalysis.Host.Mef;
+using Microsoft.CodeAnalysis.Razor;
+
+namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor
+{
+ [Shared]
+ [ExportWorkspaceServiceFactory(typeof(ErrorReporter), ServiceLayer.Host)]
+ internal class VisualStudioErrorReporterFactory : IWorkspaceServiceFactory
+ {
+ public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
+ {
+ return new VisualStudioErrorReporter();
+ }
+ }
+}