Browse Source

Allow to continue running the LoadSolutionProjects thread when there's an exception.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4726 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 16 years ago
parent
commit
6a37ebba2a
  1. 2
      src/Main/Base/Project/Src/Project/MSBuildEngine/ParallelMSBuildManager.cs
  2. 54
      src/Main/Base/Project/Src/Services/ParserService/LoadSolutionProjects.cs
  3. 6
      src/Main/Base/Project/Src/Services/ParserService/ParserService.cs

2
src/Main/Base/Project/Src/Project/MSBuildEngine/ParallelMSBuildManager.cs

@ -94,8 +94,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -94,8 +94,6 @@ namespace ICSharpCode.SharpDevelop.Project
#endif
};
parameters.EnableNodeReuse = false;
// parallel build seems to break in-memory modifications of the project (additionalTargetFiles+_ComputeNonExistentFileProperty),
// so we keep it disabled for the moment.
parameters.MaxNodeCount = BuildOptions.DefaultParallelProjectCount;
BuildManager.DefaultBuildManager.BeginBuild(parameters);
}

54
src/Main/Base/Project/Src/Services/ParserService/LoadSolutionProjects.cs

@ -205,37 +205,35 @@ namespace ICSharpCode.SharpDevelop @@ -205,37 +205,35 @@ namespace ICSharpCode.SharpDevelop
void RunThread()
{
try {
while (true) {
CancellationToken token;
JobTask task;
int totalWork, workDone;
lock (lockObj) {
if (actions.Count == 0) {
this.threadIsRunning = false;
progressMonitor.Done();
return;
}
task = this.actions.Dequeue();
token = this.cancellationSource.Token;
totalWork = this.totalWork;
workDone = this.workDone;
}
if (task.cost > 0) {
progressMonitor.BeginTask(task.name, totalWork, false);
progressMonitor.WorkDone = workDone;
while (true) {
CancellationToken token;
JobTask task;
int totalWork, workDone;
lock (lockObj) {
if (actions.Count == 0) {
this.threadIsRunning = false;
progressMonitor.Done();
return;
}
try {
task.Run(token);
lock (lockObj) {
this.workDone += task.cost;
}
} catch (OperationCanceledException) {
// ignore cancellation
task = this.actions.Dequeue();
token = this.cancellationSource.Token;
totalWork = this.totalWork;
workDone = this.workDone;
}
if (task.cost > 0) {
progressMonitor.BeginTask(task.name, totalWork, false);
progressMonitor.WorkDone = workDone;
}
try {
task.Run(token);
lock (lockObj) {
this.workDone += task.cost;
}
} catch (OperationCanceledException) {
// ignore cancellation
} catch (Exception ex) {
MessageService.ShowError(ex, "Error on LoadSolutionProjects thread");
}
} catch (Exception ex) {
MessageService.ShowError(ex, "Error on LoadSolutionProjects thread");
}
}

6
src/Main/Base/Project/Src/Services/ParserService/ParserService.cs

@ -404,7 +404,11 @@ namespace ICSharpCode.SharpDevelop @@ -404,7 +404,11 @@ namespace ICSharpCode.SharpDevelop
ICompilationUnit resultUnit = null;
for (int i = 0; i < newUnits.Length; i++) {
IProjectContent pc = projectContents[i];
newUnits[i] = parser.Parse(pc, fileName, fileContent);
try {
newUnits[i] = parser.Parse(pc, fileName, fileContent);
} catch (Exception ex) {
throw new ApplicationException("Error parsing " + fileName, ex);
}
if (i == 0 || pc == parentProjectContent)
resultUnit = newUnits[i];
}

Loading…
Cancel
Save