Browse Source

Fix various crashes reported by UDC.

pull/39/merge
Daniel Grunwald 13 years ago
parent
commit
9cc8c5248d
  1. 4
      src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/WebProjectOptions/WebProjectOptionsPanel.xaml.cs
  2. 2
      src/AddIns/Misc/SharpRefactoring/Project/Src/MethodExtractorBase.cs
  3. 7
      src/Main/Base/Project/Src/Services/ParserService/Doozer/ProjectContentRegistryDescriptor.cs
  4. 2
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/EditorContext.cs
  5. 9
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/XmlDoc.cs

4
src/AddIns/BackendBindings/AspNet.Mvc/Project/Src/WebProjectOptions/WebProjectOptionsPanel.xaml.cs

@ -176,7 +176,9 @@ namespace ICSharpCode.AspNet.Mvc
void PortTextBox_KeyUp(object sender, KeyEventArgs e) void PortTextBox_KeyUp(object sender, KeyEventArgs e)
{ {
properties.DevelopmentServerPort = Int32.Parse(PortTextBox.Text); int port;
if (int.TryParse(PortTextBox.Text, out port))
properties.DevelopmentServerPort = port;
properties.IISUrl = String.Format(@"{0}:{1}/", WebBehavior.LocalHost, PortTextBox.Text); properties.IISUrl = String.Format(@"{0}:{1}/", WebBehavior.LocalHost, PortTextBox.Text);
} }
} }

2
src/AddIns/Misc/SharpRefactoring/Project/Src/MethodExtractorBase.cs

@ -137,6 +137,8 @@ namespace SharpRefactoring
protected bool IsInCurrentSelection(Location location) protected bool IsInCurrentSelection(Location location)
{ {
if (location.IsEmpty)
return false;
return IsInCurrentSelection(textEditor.Document.PositionToOffset(location.Line, location.Column)); return IsInCurrentSelection(textEditor.Document.PositionToOffset(location.Line, location.Column));
} }

7
src/Main/Base/Project/Src/Services/ParserService/Doozer/ProjectContentRegistryDescriptor.cs

@ -34,7 +34,12 @@ namespace ICSharpCode.SharpDevelop
// aren't used with project content registries, and this code // aren't used with project content registries, and this code
// will be removed in SD5. // will be removed in SD5.
#pragma warning disable 618 #pragma warning disable 618
return codon.GetFailedAction(project) == ConditionFailedAction.Nothing; try {
return codon.GetFailedAction(project) == ConditionFailedAction.Nothing;
} catch (ObjectDisposedException) {
// This method may be used on a background thread, so there's a chance that the project got disposed.
return false;
}
} }
public ProjectContentRegistryDescriptor(Codon codon) public ProjectContentRegistryDescriptor(Codon codon)

2
src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/EditorContext.cs

@ -105,6 +105,8 @@ namespace ICSharpCode.SharpDevelop.Refactoring
public ResolveResult ResolveExpression(Expression expression) public ResolveResult ResolveExpression(Expression expression)
{ {
if (expression.EndLocation.IsEmpty)
return null;
ExpressionResult expr = GetExpressionAt(this.Editor, expression.EndLocation.Line, expression.EndLocation.Column); ExpressionResult expr = GetExpressionAt(this.Editor, expression.EndLocation.Line, expression.EndLocation.Column);
return ResolveExpression(expr, this.Editor, expression.EndLocation.Line, expression.EndLocation.Column); return ResolveExpression(expr, this.Editor, expression.EndLocation.Line, expression.EndLocation.Column);
} }

9
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/XmlDoc.cs

@ -68,8 +68,13 @@ namespace ICSharpCode.SharpDevelop.Dom
public string GetDocumentation(string key) public string GetDocumentation(string key)
{ {
if (xmlDescription == null) if (xmlDescription == null) {
throw new ObjectDisposedException("XmlDoc"); //throw new ObjectDisposedException("XmlDoc");
// Sometimes SD accesses a project content after it is disposed.
// Not sure why, but we can avoid the crash by just returning null.
// SD5 fixes the issue by making IProjectContent immutable (no Dispose() method)
return null;
}
lock (xmlDescription) { lock (xmlDescription) {
string result; string result;
if (xmlDescription.TryGetValue(key, out result)) if (xmlDescription.TryGetValue(key, out result))

Loading…
Cancel
Save