diff --git a/src/ClassExplorer/ClassExplorer.csproj b/src/ClassExplorer/ClassExplorer.csproj
index a2359c4..0e41c3f 100644
--- a/src/ClassExplorer/ClassExplorer.csproj
+++ b/src/ClassExplorer/ClassExplorer.csproj
@@ -7,6 +7,8 @@
true
enable
true
+
+ $(NoWarn);SYSLIB0037
diff --git a/src/ClassExplorer/ReflectionCache.cs b/src/ClassExplorer/ReflectionCache.cs
index 19d064c..88de67b 100644
--- a/src/ClassExplorer/ReflectionCache.cs
+++ b/src/ClassExplorer/ReflectionCache.cs
@@ -37,13 +37,19 @@ public static string[] GetUsingNamespacesFromTLS()
if (GetExecutionContextFromTLSMethod is null) return null;
- PropertyInfo? getEngineSessionState = ExecutionContextType?.GetProperty("EngineSessionState", flags);
+ MethodInfo? getEngineSessionState = ExecutionContextType
+ ?.GetProperty("EngineSessionState", flags)
+ ?.GetGetMethod(nonPublic: true);
if (getEngineSessionState is null) return null;
- PropertyInfo? currentScope = getEngineSessionState.GetReturnType()?.GetProperty("CurrentScope", flags);
+ MethodInfo? currentScope = getEngineSessionState?.ReturnType
+ ?.GetProperty("CurrentScope", flags)
+ ?.GetGetMethod(nonPublic: true);
if (currentScope is null) return null;
- PropertyInfo? typeRes = currentScope.GetReturnType()?.GetProperty("TypeResolutionState", flags);
+ MethodInfo? typeRes = currentScope?.ReturnType
+ ?.GetProperty("TypeResolutionState", flags)
+ ?.GetGetMethod(nonPublic: true);
if (typeRes is null) return null;
FieldInfo? namespaces = typeRes.GetReturnType()?.GetField("namespaces", flags);
@@ -56,9 +62,9 @@ public static string[] GetUsingNamespacesFromTLS()
Expression.Call(
Expression.Call(
Expression.Call(GetExecutionContextFromTLSMethod),
- getEngineSessionState.GetGetMethod(nonPublic: true)),
- currentScope.GetGetMethod(nonPublic: true)),
- typeRes.GetGetMethod(nonPublic: true)),
+ getEngineSessionState!),
+ currentScope!),
+ typeRes),
namespaces),
"GetUsingNamespacesDynamically",
[])
diff --git a/src/ClassExplorer/SignatureWriter.cs b/src/ClassExplorer/SignatureWriter.cs
index a64d51e..ede0b94 100644
--- a/src/ClassExplorer/SignatureWriter.cs
+++ b/src/ClassExplorer/SignatureWriter.cs
@@ -1815,6 +1815,9 @@ public SignatureWriter Member(PropertyInfo property)
Modifiers(modifiersMethod);
}
+ Poly.Assert(name is not null);
+ Poly.Assert(propertyParameter is not null);
+
TypeInfo(propertyParameter).Space();
if (isExplicitImplementation)
{
@@ -1885,6 +1888,7 @@ public SignatureWriter Member(EventInfo eventInfo)
eventParameter = removeMethod!.GetParameters().FirstOrDefault();
}
+ Poly.Assert(eventParameter is not null);
Modifiers(modifiersMethod).Keyword("event").Space().TypeInfo(eventParameter).Space();
MemberName(eventInfo.Name).Space();
OpenCurly().Space();
diff --git a/src/ClassExplorer/Signatures/FullMethodSignature.cs b/src/ClassExplorer/Signatures/FullMethodSignature.cs
index 12aa7e8..432dd56 100644
--- a/src/ClassExplorer/Signatures/FullMethodSignature.cs
+++ b/src/ClassExplorer/Signatures/FullMethodSignature.cs
@@ -18,7 +18,7 @@ public override bool IsMatch(MemberInfo subject)
if (subject is ConstructorInfo ctor)
{
- if (!ReturnType.IsMatch(ctor.ReflectedType))
+ if (ctor.ReflectedType is null || !ReturnType.IsMatch(ctor.ReflectedType))
{
return false;
}
diff --git a/src/ClassExplorer/TypeSearch.cs b/src/ClassExplorer/TypeSearch.cs
index 0ba88fa..1198f81 100644
--- a/src/ClassExplorer/TypeSearch.cs
+++ b/src/ClassExplorer/TypeSearch.cs
@@ -142,7 +142,7 @@ protected override void InitializeOtherFilters(List> filters, Signa
{
filters.AddFilter(
StringMatcher.CreateRegex(_options.FullName),
- static (type, matcher) => matcher.IsMatch(type.FullName));
+ static (type, matcher) => matcher.IsMatch(type.FullName ?? ""));
}
else
{