diff options
author | Lluis Sanchez <llsan@microsoft.com> | 2019-05-06 15:40:06 +0300 |
---|---|---|
committer | Lluis Sanchez <llsan@microsoft.com> | 2019-05-06 15:40:06 +0300 |
commit | 9bb2c7210641342df37d2744d643900d16f07370 (patch) | |
tree | 5ba5f4ab1a94140861374661b9ae7d094b3ccca6 | |
parent | f090a29bfc48f85421f9bb43dc768eeb73303e05 (diff) | |
parent | fa738a98f02d2d2826851bd99c74661c14926f00 (diff) |
Merge branch 'master-vnext'
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs | 20 | ||||
-rw-r--r-- | main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs | 14 |
2 files changed, 22 insertions, 12 deletions
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs index 4408493197..d2874912c7 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildProjectService.cs @@ -603,8 +603,8 @@ namespace MonoDevelop.Projects.MSBuild return false; LoggingService.LogError (Environment.StackTrace); - monitor.ReportError ("Could not open unmigrated project and no migrator was supplied", null); - throw new UserException ("Project migration failed"); + monitor.ReportError (GettextCatalog.GetString ("Could not open unmigrated project and no migrator was supplied"), null); + throw new UserException (GettextCatalog.GetString ("Project migration failed")); } var migrationType = st.MigrationHandler.CanPromptForMigration @@ -612,8 +612,8 @@ namespace MonoDevelop.Projects.MSBuild : projectLoadMonitor.ShouldMigrateProject (); if (migrationType == MigrationType.Ignore) { if (st.IsMigrationRequired) { - monitor.ReportError (string.Format ("{1} cannot open the project '{0}' unless it is migrated.", Path.GetFileName (fileName), BrandingService.ApplicationName), null); - throw new UserException ("The user choose not to migrate the project"); + monitor.ReportError (GettextCatalog.GetString ("{1} cannot open the project '{0}' unless it is migrated.", Path.GetFileName (fileName), BrandingService.ApplicationName), null); + throw new UserException (GettextCatalog.GetString ("The user choose not to migrate the project")); } else return false; } @@ -635,7 +635,7 @@ namespace MonoDevelop.Projects.MSBuild } if (!await st.MigrationHandler.Migrate (projectLoadMonitor, p, fileName, language)) - throw new UserException ("Project migration failed"); + throw new UserException (GettextCatalog.GetString ("Project migration failed")); return true; } @@ -783,22 +783,24 @@ namespace MonoDevelop.Projects.MSBuild if (file == null) return Task.FromResult<SolutionItem> (new GenericProject ()); + // Unknown project types are already displayed in the solution view, we don't need to tell the user with a modal dialog as well return Task<SolutionItem>.Factory.StartNew (delegate { var t = ReadGenericProjectType (file); if (t == null) - throw new UserException ("Unknown project type"); + throw new UnknownSolutionItemTypeException (GettextCatalog.GetString ("Unknown project type")); var dt = Services.ProjectService.DataContext.GetConfigurationDataType (t); if (dt != null) { - if (!typeof(Project).IsAssignableFrom (dt.ValueType)) - throw new UserException ("Unknown project type: " + t); + if (!typeof (Project).IsAssignableFrom (dt.ValueType)) + throw new UnknownSolutionItemTypeException (GettextCatalog.GetString ("Unknown project type: {0}", t)); + return (SolutionItem)Activator.CreateInstance (dt.ValueType); } Type type; lock (genericProjectTypes) { if (!genericProjectTypes.TryGetValue (t, out type)) - throw new UserException ("Unknown project type: " + t); + throw new UnknownSolutionItemTypeException (GettextCatalog.GetString ("Unknown project type: {0}", t)); } return (SolutionItem)Activator.CreateInstance (type); }); diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs index be5910cc7f..536216a261 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SlnFileFormat.cs @@ -492,14 +492,22 @@ namespace MonoDevelop.Projects.MSBuild string unsupportedMessage = e.Message; - if (e is UserException) { - var ex = (UserException) e; + switch (e) { + case UserException ex: LoggingService.LogError ("{0}: {1}", ex.Message, ex.Details); + monitor.ReportError (string.Format ("{0}{1}{1}{2}", ex.Message, Environment.NewLine, ex.Details), null); - } else { + break; + + case UnknownSolutionItemTypeException ux: + LoggingService.LogError ("{0}: {1}", ux.Message, projectPath); + break; + + default: LoggingService.LogError (string.Format ("Error while trying to load the project {0}", projectPath), e); monitor.ReportWarning (GettextCatalog.GetString ( "Error while trying to load the project '{0}': {1}", projectPath, e.Message)); + break; } SolutionItem uitem; |