Browse Source

Fixed problem with trailing space in expressions for VB debugger tooltips.

DomPersistence no longer crashes when the cache index file is corrupted.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1307 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
37d60be346
  1. 36
      src/Main/Base/Project/Src/Dom/ReflectionLayer/DomPersistence.cs
  2. 5
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
  3. 4
      src/Main/Base/Project/Src/Services/RefactoringService/CodeGenerator.cs

36
src/Main/Base/Project/Src/Dom/ReflectionLayer/DomPersistence.cs

@ -107,27 +107,29 @@ namespace ICSharpCode.SharpDevelop.Dom
string indexFile = GetIndexFileName(); string indexFile = GetIndexFileName();
Dictionary<string, string> list = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase); Dictionary<string, string> list = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
if (File.Exists(indexFile)) { if (File.Exists(indexFile)) {
using (FileStream fs = new FileStream(indexFile, FileMode.Open, FileAccess.Read)) { try {
using (BinaryReader reader = new BinaryReader(fs)) { using (FileStream fs = new FileStream(indexFile, FileMode.Open, FileAccess.Read)) {
if (reader.ReadInt64() != IndexFileMagic) { using (BinaryReader reader = new BinaryReader(fs)) {
LoggingService.Warn("Index cache has wrong file magic"); if (reader.ReadInt64() != IndexFileMagic) {
return list; LoggingService.Warn("Index cache has wrong file magic");
} return list;
if (reader.ReadInt16() != FileVersion) { }
LoggingService.Warn("Index cache has wrong file version"); if (reader.ReadInt16() != FileVersion) {
return list; LoggingService.Warn("Index cache has wrong file version");
} return list;
int count = reader.ReadInt32(); }
for (int i = 0; i < count; i++) { int count = reader.ReadInt32();
string key = reader.ReadString(); for (int i = 0; i < count; i++) {
list[key] = reader.ReadString(); string key = reader.ReadString();
list[key] = reader.ReadString();
}
} }
return list;
} }
} catch (IOException ex) {
LoggingService.Warn("Error reading DomPersistance cache index", ex);
} }
} else {
return list;
} }
return list;
} }
static void SaveCacheIndex(Dictionary<string, string> cacheIndex) static void SaveCacheIndex(Dictionary<string, string> cacheIndex)

5
src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

@ -311,8 +311,8 @@ namespace ICSharpCode.Core
return; return;
string textContent = doc.TextContent; string textContent = doc.TextContent;
ExpressionResult expressionResult = expressionFinder.FindFullExpression(textContent, seg.Offset + logicPos.X); ExpressionResult expressionResult = expressionFinder.FindFullExpression(textContent, seg.Offset + logicPos.X);
string expression = expressionResult.Expression; string expression = (expressionResult.Expression ?? "").Trim();
if (expression != null && expression.Length > 0) { if (expression.Length > 0) {
// Look if it is variable // Look if it is variable
ResolveResult result = ParserService.Resolve(expressionResult, logicPos.Y + 1, logicPos.X + 1, textArea.MotherTextEditorControl.FileName, textContent); ResolveResult result = ParserService.Resolve(expressionResult, logicPos.Y + 1, logicPos.X + 1, textArea.MotherTextEditorControl.FileName, textContent);
bool debuggerCanShowValue; bool debuggerCanShowValue;
@ -446,6 +446,7 @@ namespace ICSharpCode.Core
text.Append(member.ToString()); text.Append(member.ToString());
} }
if (tryDisplayValue && currentDebugger != null) { if (tryDisplayValue && currentDebugger != null) {
LoggingService.Info("asking debugger for value of '" + expression + "'");
string currentValue = currentDebugger.GetValueAsString(expression); string currentValue = currentDebugger.GetValueAsString(expression);
if (currentValue != null) { if (currentValue != null) {
debuggerCanShowValue = true; debuggerCanShowValue = true;

4
src/Main/Base/Project/Src/Services/RefactoringService/CodeGenerator.cs

@ -348,7 +348,9 @@ namespace ICSharpCode.SharpDevelop.Refactoring
public virtual MethodDeclaration CreateOnEventMethod(IEvent e) public virtual MethodDeclaration CreateOnEventMethod(IEvent e)
{ {
TypeReference type; TypeReference type;
if (e.ReturnType.TypeArguments != null && e.ReturnType.Name == "EventHandler") { if (e.ReturnType == null) {
type = new TypeReference("?");
} else if (e.ReturnType.TypeArguments != null && e.ReturnType.Name == "EventHandler") {
type = ConvertType(e.ReturnType.TypeArguments[0], new ClassFinder(e)); type = ConvertType(e.ReturnType.TypeArguments[0], new ClassFinder(e));
} else { } else {
type = ConvertType(e.ReturnType, new ClassFinder(e)); type = ConvertType(e.ReturnType, new ClassFinder(e));

Loading…
Cancel
Save