Browse Source

SD2-702 - Importing an old project that is read-only throws an unhandled exception. The unauthorized access exception is now caught and an error message is displayed to the user.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1243 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 20 years ago
parent
commit
193486b9a3
  1. 16
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

16
src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

@ -214,9 +214,14 @@ namespace ICSharpCode.SharpDevelop.Project @@ -214,9 +214,14 @@ namespace ICSharpCode.SharpDevelop.Project
public static void LoadSolution(string fileName)
{
BeforeLoadSolution();
openSolution = Solution.Load(fileName);
if (openSolution == null)
try {
openSolution = Solution.Load(fileName);
if (openSolution == null)
return;
} catch (UnauthorizedAccessException ex) {
MessageService.ShowError(ex.Message);
return;
}
try {
string file = GetPreferenceFileName(openSolution.FileName);
if (FileUtility.IsValidFileName(file) && File.Exists(file)) {
@ -258,7 +263,12 @@ namespace ICSharpCode.SharpDevelop.Project @@ -258,7 +263,12 @@ namespace ICSharpCode.SharpDevelop.Project
ILanguageBinding binding = LanguageBindingService.GetBindingPerProjectFile(fileName);
IProject project;
if (binding != null) {
project = LanguageBindingService.LoadProject(fileName, solution.Name);
try {
project = LanguageBindingService.LoadProject(fileName, solution.Name);
} catch (UnauthorizedAccessException ex) {
MessageService.ShowError(ex.Message);
return;
}
} else {
MessageService.ShowError(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.OpenCombine.InvalidProjectOrCombine}", new string[,] {{"FileName", fileName}}));
return;

Loading…
Cancel
Save