Browse Source

Fix a possible NRE in XmlDocumentationElement and wrong nullable annotations in analyzers.

net10upgrade
Siegfried Pammer 3 weeks ago
parent
commit
a85e5b513d
  1. 4
      ICSharpCode.Decompiler/Documentation/XmlDocumentationElement.cs
  2. 6
      ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs

4
ICSharpCode.Decompiler/Documentation/XmlDocumentationElement.cs

@ -193,9 +193,9 @@ namespace ICSharpCode.Decompiler.Documentation @@ -193,9 +193,9 @@ namespace ICSharpCode.Decompiler.Documentation
if (inheritedFrom != null)
inheritedDocumentation = "<doc>" + inheritedFrom.GetDocumentation() + "</doc>";
}
else
else if (declaringEntity != null)
{
foreach (IMember baseMember in InheritanceHelper.GetBaseMembers((IMember?)declaringEntity, includeImplementedInterfaces: true))
foreach (IMember baseMember in InheritanceHelper.GetBaseMembers((IMember)declaringEntity, includeImplementedInterfaces: true))
{
inheritedDocumentation = baseMember.GetDocumentation();
if (inheritedDocumentation != null)

6
ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs

@ -45,7 +45,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin @@ -45,7 +45,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
Debug.Assert(analyzedSymbol is IMethod);
var analyzedMethod = (IMethod)analyzedSymbol;
var analyzedBaseMethod = (IMethod)InheritanceHelper.GetBaseMember(analyzedMethod);
var analyzedBaseMethod = (IMethod?)InheritanceHelper.GetBaseMember(analyzedMethod);
if (analyzedMethod.ParentModule?.MetadataFile == null)
yield break;
var mapping = context.Language
@ -109,12 +109,12 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin @@ -109,12 +109,12 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
}
}
bool IsUsedInMethod(IMethod analyzedEntity, IMethod analyzedBaseMethod, IMethod method, AnalyzerContext context)
bool IsUsedInMethod(IMethod analyzedEntity, IMethod? analyzedBaseMethod, IMethod method, AnalyzerContext context)
{
return ScanMethodBody(analyzedEntity, method, analyzedBaseMethod, context.GetMethodBody(method));
}
static bool ScanMethodBody(IMethod analyzedMethod, IMethod method, IMethod analyzedBaseMethod, MethodBodyBlock? methodBody)
static bool ScanMethodBody(IMethod analyzedMethod, IMethod method, IMethod? analyzedBaseMethod, MethodBodyBlock? methodBody)
{
if (methodBody == null || method.ParentModule?.MetadataFile == null)
return false;

Loading…
Cancel
Save