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

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

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

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

@ -348,7 +348,9 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -348,7 +348,9 @@ namespace ICSharpCode.SharpDevelop.Refactoring
public virtual MethodDeclaration CreateOnEventMethod(IEvent e)
{
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));
} else {
type = ConvertType(e.ReturnType, new ClassFinder(e));

Loading…
Cancel
Save