Browse Source

Fixed SD2-815: Generic delegate throws null reference exception

Fixed SD2-819: Disabling code coverage and code analysis addin causes error on showing project properties

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1426 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
374bcd7409
  1. 4
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 7
      src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs
  3. 4
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/TypeVisitor.cs
  4. 20
      src/Main/Base/Project/Src/Services/ParserService/IProjectContent.cs

4
AddIns/ICSharpCode.SharpDevelop.addin

@ -2123,4 +2123,8 @@
<String id = "FormsDesignerGeneratedCode" text=".Designer${Extension}"/> <String id = "FormsDesignerGeneratedCode" text=".Designer${Extension}"/>
<String id = "FormsDesignerResources" text=".resx"/> <String id = "FormsDesignerResources" text=".resx"/>
</Path> </Path>
<Path name="/SharpDevelop/BackendBindings/ProjectOptions/AllManaged">
<!-- put project option panels valid for all .NET projects here -->
</Path>
</AddIn> </AddIn>

7
src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs

@ -67,19 +67,20 @@ namespace ICSharpCode.SharpDevelop.Dom
internal static void AddDefaultDelegateMethod(DefaultClass c, IReturnType returnType, IList<IParameter> parameters) internal static void AddDefaultDelegateMethod(DefaultClass c, IReturnType returnType, IList<IParameter> parameters)
{ {
DefaultMethod invokeMethod = new DefaultMethod("Invoke", returnType, ModifierEnum.Public, c.Region, DomRegion.Empty, c); ModifierEnum modifiers = ModifierEnum.Public | ModifierEnum.Synthetic;
DefaultMethod invokeMethod = new DefaultMethod("Invoke", returnType, modifiers, c.Region, DomRegion.Empty, c);
foreach (IParameter par in parameters) { foreach (IParameter par in parameters) {
invokeMethod.Parameters.Add(par); invokeMethod.Parameters.Add(par);
} }
c.Methods.Add(invokeMethod); c.Methods.Add(invokeMethod);
invokeMethod = new DefaultMethod("BeginInvoke", c.ProjectContent.SystemTypes.IAsyncResult, ModifierEnum.Public, c.Region, DomRegion.Empty, c); invokeMethod = new DefaultMethod("BeginInvoke", c.ProjectContent.SystemTypes.IAsyncResult, modifiers, c.Region, DomRegion.Empty, c);
foreach (IParameter par in parameters) { foreach (IParameter par in parameters) {
invokeMethod.Parameters.Add(par); invokeMethod.Parameters.Add(par);
} }
invokeMethod.Parameters.Add(new DefaultParameter("callback", c.ProjectContent.SystemTypes.AsyncCallback, DomRegion.Empty)); invokeMethod.Parameters.Add(new DefaultParameter("callback", c.ProjectContent.SystemTypes.AsyncCallback, DomRegion.Empty));
invokeMethod.Parameters.Add(new DefaultParameter("object", c.ProjectContent.SystemTypes.Object, DomRegion.Empty)); invokeMethod.Parameters.Add(new DefaultParameter("object", c.ProjectContent.SystemTypes.Object, DomRegion.Empty));
c.Methods.Add(invokeMethod); c.Methods.Add(invokeMethod);
invokeMethod = new DefaultMethod("EndInvoke", returnType, ModifierEnum.Public, c.Region, DomRegion.Empty, c); invokeMethod = new DefaultMethod("EndInvoke", returnType, modifiers, c.Region, DomRegion.Empty, c);
invokeMethod.Parameters.Add(new DefaultParameter("result", c.ProjectContent.SystemTypes.IAsyncResult, DomRegion.Empty)); invokeMethod.Parameters.Add(new DefaultParameter("result", c.ProjectContent.SystemTypes.IAsyncResult, DomRegion.Empty));
c.Methods.Add(invokeMethod); c.Methods.Add(invokeMethod);
} }

4
src/Main/Base/Project/Src/Dom/NRefactoryResolver/TypeVisitor.cs

@ -499,14 +499,14 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
if (useLazyReturnType) { if (useLazyReturnType) {
if (reference.IsGlobal) if (reference.IsGlobal)
t = new GetClassReturnType(projectContent, reference.SystemType, typeParameterCount); t = new GetClassReturnType(projectContent, reference.SystemType, typeParameterCount);
else else if (callingClass != null)
t = new SearchClassReturnType(projectContent, callingClass, caretLine, caretColumn, reference.SystemType, typeParameterCount); t = new SearchClassReturnType(projectContent, callingClass, caretLine, caretColumn, reference.SystemType, typeParameterCount);
} else { } else {
IClass c; IClass c;
if (reference.IsGlobal) { if (reference.IsGlobal) {
c = projectContent.GetClass(reference.SystemType, typeParameterCount); c = projectContent.GetClass(reference.SystemType, typeParameterCount);
t = (c != null) ? c.DefaultReturnType : null; t = (c != null) ? c.DefaultReturnType : null;
} else { } else if (callingClass != null) {
t = projectContent.SearchType(new SearchTypeRequest(reference.SystemType, typeParameterCount, callingClass, caretLine, caretColumn)).Result; t = projectContent.SearchType(new SearchTypeRequest(reference.SystemType, typeParameterCount, callingClass, caretLine, caretColumn)).Result;
} }
if (t == null) { if (t == null) {

20
src/Main/Base/Project/Src/Services/ParserService/IProjectContent.cs

@ -89,15 +89,17 @@ namespace ICSharpCode.Core
public struct SearchTypeRequest public struct SearchTypeRequest
{ {
public string Name; public readonly string Name;
public int TypeParameterCount; public readonly int TypeParameterCount;
public ICompilationUnit CurrentCompilationUnit; public readonly ICompilationUnit CurrentCompilationUnit;
public IClass CurrentType; public readonly IClass CurrentType;
public int CaretLine; public readonly int CaretLine;
public int CaretColumn; public readonly int CaretColumn;
public SearchTypeRequest(string name, int typeParameterCount, IClass currentType, int caretLine, int caretColumn) public SearchTypeRequest(string name, int typeParameterCount, IClass currentType, int caretLine, int caretColumn)
{ {
if (currentType == null)
throw new ArgumentNullException("currentType");
this.Name = name; this.Name = name;
this.TypeParameterCount = typeParameterCount; this.TypeParameterCount = typeParameterCount;
this.CurrentCompilationUnit = currentType.CompilationUnit; this.CurrentCompilationUnit = currentType.CompilationUnit;
@ -108,6 +110,8 @@ namespace ICSharpCode.Core
public SearchTypeRequest(string name, int typeParameterCount, IClass currentType, ICompilationUnit currentCompilationUnit, int caretLine, int caretColumn) public SearchTypeRequest(string name, int typeParameterCount, IClass currentType, ICompilationUnit currentCompilationUnit, int caretLine, int caretColumn)
{ {
if (currentCompilationUnit == null)
throw new ArgumentNullException("currentCompilationUnit");
this.Name = name; this.Name = name;
this.TypeParameterCount = typeParameterCount; this.TypeParameterCount = typeParameterCount;
this.CurrentCompilationUnit = currentCompilationUnit; this.CurrentCompilationUnit = currentCompilationUnit;
@ -121,8 +125,8 @@ namespace ICSharpCode.Core
{ {
public static readonly SearchTypeResult Empty = new SearchTypeResult(null); public static readonly SearchTypeResult Empty = new SearchTypeResult(null);
IReturnType result; readonly IReturnType result;
IUsing usedUsing; readonly IUsing usedUsing;
public SearchTypeResult(IReturnType result) : this(result, null) {} public SearchTypeResult(IReturnType result) : this(result, null) {}

Loading…
Cancel
Save