Browse Source

Add workaround for exception in RefactoringService.FixIndexerExpression

4.0
Daniel Grunwald 15 years ago
parent
commit
947f4eea3e
  1. 8
      src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs

8
src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs

@ -354,7 +354,13 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -354,7 +354,13 @@ namespace ICSharpCode.SharpDevelop.Refactoring
// strip the index from the expression to resolve the underlying expression
string newExpr = expressionFinder.RemoveLastPart(expr.Expression);
if (newExpr.Length >= expr.Expression.Length) {
throw new ApplicationException("new expression must be shorter than old expression");
//throw new ApplicationException("new expression must be shorter than old expression");
// If the exception finder doesn't work as expected, we just pretend this wasn't an indexer.
// This method of 'Find References' will become obsolete with the new NRefactory anyways,
// so since we likely won't spend time to track down the EF bug, we just ignore it and accept
// that 'find references' might sometimes miss some results.
return false;
}
expr.Expression = newExpr;
return true;

Loading…
Cancel
Save