diff --git a/ICSharpCode.Decompiler/CSharp/Resolver/CSharpResolver.cs b/ICSharpCode.Decompiler/CSharp/Resolver/CSharpResolver.cs
index 239e3af97..bfe186000 100644
--- a/ICSharpCode.Decompiler/CSharp/Resolver/CSharpResolver.cs
+++ b/ICSharpCode.Decompiler/CSharp/Resolver/CSharpResolver.cs
@@ -154,7 +154,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
 			return WithContext(context.WithCurrentMember(member));
 		}
 
-		ITypeResolveContext ITypeResolveContext.WithCurrentMember(IMember member)
+		ITypeResolveContext ITypeResolveContext.WithCurrentMember(IMember? member)
 		{
 			return WithCurrentMember(member);
 		}
@@ -188,7 +188,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
 		/// <summary>
 		/// Sets the current type definition.
 		/// </summary>
-		public CSharpResolver WithCurrentTypeDefinition(ITypeDefinition typeDefinition)
+		public CSharpResolver WithCurrentTypeDefinition(ITypeDefinition? typeDefinition)
 		{
 			if (this.CurrentTypeDefinition == typeDefinition)
 				return this;
@@ -203,7 +203,7 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
 									  checkForOverflow, isWithinLambdaExpression, newTypeDefinitionCache, localVariableStack, objectInitializerStack);
 		}
 
-		ITypeResolveContext ITypeResolveContext.WithCurrentTypeDefinition(ITypeDefinition typeDefinition)
+		ITypeResolveContext ITypeResolveContext.WithCurrentTypeDefinition(ITypeDefinition? typeDefinition)
 		{
 			return WithCurrentTypeDefinition(typeDefinition);
 		}
diff --git a/ICSharpCode.Decompiler/CSharp/TypeSystem/CSharpTypeResolveContext.cs b/ICSharpCode.Decompiler/CSharp/TypeSystem/CSharpTypeResolveContext.cs
index 9f8d94406..8a0374f2c 100644
--- a/ICSharpCode.Decompiler/CSharp/TypeSystem/CSharpTypeResolveContext.cs
+++ b/ICSharpCode.Decompiler/CSharp/TypeSystem/CSharpTypeResolveContext.cs
@@ -17,6 +17,7 @@
 // DEALINGS IN THE SOFTWARE.
 
 using System;
+using System.Diagnostics.CodeAnalysis;
 
 using ICSharpCode.Decompiler.TypeSystem;
 
@@ -25,10 +26,10 @@ namespace ICSharpCode.Decompiler.CSharp.TypeSystem
 	public sealed class CSharpTypeResolveContext : ITypeResolveContext
 	{
 		readonly IModule module;
-		readonly ResolvedUsingScope currentUsingScope;
-		readonly ITypeDefinition currentTypeDefinition;
-		readonly IMember currentMember;
-		readonly string[] methodTypeParameterNames;
+		readonly ResolvedUsingScope? currentUsingScope;
+		readonly ITypeDefinition? currentTypeDefinition;
+		readonly IMember? currentMember;
+		readonly string[]? methodTypeParameterNames;
 
 		public CSharpTypeResolveContext(IModule module, ResolvedUsingScope? usingScope = null, ITypeDefinition? typeDefinition = null, IMember? member = null)
 		{
@@ -40,7 +41,7 @@ namespace ICSharpCode.Decompiler.CSharp.TypeSystem
 			this.currentMember = member;
 		}
 
-		private CSharpTypeResolveContext(IModule module, ResolvedUsingScope usingScope, ITypeDefinition typeDefinition, IMember member, string[] methodTypeParameterNames)
+		private CSharpTypeResolveContext(IModule module, ResolvedUsingScope? usingScope, ITypeDefinition? typeDefinition, IMember? member, string[]? methodTypeParameterNames)
 		{
 			this.module = module;
 			this.currentUsingScope = usingScope;
@@ -49,7 +50,7 @@ namespace ICSharpCode.Decompiler.CSharp.TypeSystem
 			this.methodTypeParameterNames = methodTypeParameterNames;
 		}
 
-		public ResolvedUsingScope CurrentUsingScope {
+		public ResolvedUsingScope? CurrentUsingScope {
 			get { return currentUsingScope; }
 		}
 
@@ -61,30 +62,31 @@ namespace ICSharpCode.Decompiler.CSharp.TypeSystem
 			get { return module; }
 		}
 
-		public ITypeDefinition CurrentTypeDefinition {
+		public ITypeDefinition? CurrentTypeDefinition {
 			get { return currentTypeDefinition; }
 		}
 
-		public IMember CurrentMember {
+		public IMember? CurrentMember {
 			get { return currentMember; }
 		}
 
-		public CSharpTypeResolveContext WithCurrentTypeDefinition(ITypeDefinition typeDefinition)
+
+		public CSharpTypeResolveContext WithCurrentTypeDefinition(ITypeDefinition? typeDefinition)
 		{
 			return new CSharpTypeResolveContext(module, currentUsingScope, typeDefinition, currentMember, methodTypeParameterNames);
 		}
 
-		ITypeResolveContext ITypeResolveContext.WithCurrentTypeDefinition(ITypeDefinition typeDefinition)
+		ITypeResolveContext ITypeResolveContext.WithCurrentTypeDefinition(ITypeDefinition? typeDefinition)
 		{
 			return WithCurrentTypeDefinition(typeDefinition);
 		}
 
-		public CSharpTypeResolveContext WithCurrentMember(IMember member)
+		public CSharpTypeResolveContext WithCurrentMember(IMember? member)
 		{
 			return new CSharpTypeResolveContext(module, currentUsingScope, currentTypeDefinition, member, methodTypeParameterNames);
 		}
 
-		ITypeResolveContext ITypeResolveContext.WithCurrentMember(IMember member)
+		ITypeResolveContext ITypeResolveContext.WithCurrentMember(IMember? member)
 		{
 			return WithCurrentMember(member);
 		}
diff --git a/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs b/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs
index fad963048..690a00150 100644
--- a/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs
+++ b/ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs
@@ -153,7 +153,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 		/// Converts a Expression.Lambda call into an ILFunction.
 		/// If the conversion fails, null is returned.
 		/// </summary>
-		(Func<ILInstruction>, IType) ConvertLambda(CallInstruction instruction)
+		(Func<ILInstruction>?, IType) ConvertLambda(CallInstruction instruction)
 		{
 			if (instruction.Method.Name != "Lambda" || instruction.Arguments.Count != 2 || instruction.Method.ReturnType.FullName != "System.Linq.Expressions.Expression" || instruction.Method.ReturnType.TypeArguments.Count != 1)
 				return (null, SpecialType.UnknownType);
@@ -198,7 +198,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			}
 		}
 
-		(Func<ILInstruction>, IType) ConvertQuote(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertQuote(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 1)
 				return (null, SpecialType.UnknownType);
@@ -266,7 +266,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			}
 		}
 
-		(Func<ILInstruction>, IType) ConvertInstruction(ILInstruction instruction, IType? typeHint = null)
+		(Func<ILInstruction>?, IType) ConvertInstruction(ILInstruction instruction, IType? typeHint = null)
 		{
 			var (inst, type) = Convert();
 
@@ -289,7 +289,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			}
 			return (DoConvert, typeHint ?? type);
 
-			(Func<ILInstruction>, IType) Convert()
+			(Func<ILInstruction>?, IType) Convert()
 			{
 				switch (instruction)
 				{
@@ -446,7 +446,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return delegateType;
 		}
 
-		(Func<ILInstruction>, IType) ConvertArrayIndex(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertArrayIndex(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 2)
 				return (null, SpecialType.UnknownType);
@@ -473,7 +473,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (Convert, type.ElementType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertArrayLength(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertArrayLength(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 1)
 				return (null, SpecialType.UnknownType);
@@ -483,7 +483,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (() => new LdLen(StackType.I4, converted()), context.TypeSystem.FindType(KnownTypeCode.Int32));
 		}
 
-		(Func<ILInstruction>, IType) ConvertBinaryNumericOperator(CallInstruction invocation, BinaryNumericOperator op, bool? isChecked = null)
+		(Func<ILInstruction>?, IType) ConvertBinaryNumericOperator(CallInstruction invocation, BinaryNumericOperator op, bool? isChecked = null)
 		{
 			if (invocation.Arguments.Count < 2)
 				return (null, SpecialType.UnknownType);
@@ -574,7 +574,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (null, SpecialType.UnknownType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertCall(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertCall(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count < 2)
 				return (null, SpecialType.UnknownType);
@@ -697,7 +697,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return converted;
 		}
 
-		(Func<ILInstruction>, IType) ConvertCast(CallInstruction invocation, bool isChecked)
+		(Func<ILInstruction>?, IType) ConvertCast(CallInstruction invocation, bool isChecked)
 		{
 			if (invocation.Arguments.Count < 2)
 				return (null, SpecialType.UnknownType);
@@ -711,7 +711,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (() => new ExpressionTreeCast(targetType, expr(), isChecked), targetType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertCoalesce(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertCoalesce(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 2)
 				return (null, SpecialType.UnknownType);
@@ -742,7 +742,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			}, targetType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertComparison(CallInstruction invocation, ComparisonKind kind)
+		(Func<ILInstruction>?, IType) ConvertComparison(CallInstruction invocation, ComparisonKind kind)
 		{
 			if (invocation.Arguments.Count < 2)
 				return (null, SpecialType.UnknownType);
@@ -790,7 +790,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (() => new Comp(kind, lifting, utype.GetStackType(), utype.GetSign(), left(), right()), resultType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertCondition(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertCondition(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 3)
 				return (null, SpecialType.UnknownType);
@@ -808,7 +808,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (() => new IfInstruction(condition(), trueInst(), falseInst()), trueInstType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertConstant(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertConstant(CallInstruction invocation)
 		{
 			if (!MatchConstantCall(invocation, out var value, out var type))
 				return (null, SpecialType.UnknownType);
@@ -821,7 +821,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (() => ConvertValue(value, invocation), type);
 		}
 
-		(Func<ILInstruction>, IType) ConvertElementInit(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertElementInit(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 2)
 				return (null, SpecialType.UnknownType);
@@ -849,7 +849,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (BuildCall, member.ReturnType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertField(CallInstruction invocation, IType typeHint)
+		(Func<ILInstruction>?, IType) ConvertField(CallInstruction invocation, IType typeHint)
 		{
 			if (invocation.Arguments.Count != 2)
 				return (null, SpecialType.UnknownType);
@@ -896,7 +896,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			}
 		}
 
-		(Func<ILInstruction>, IType) ConvertInvoke(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertInvoke(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 2)
 				return (null, SpecialType.UnknownType);
@@ -922,7 +922,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (BuildCall, invokeMethod.ReturnType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertListInit(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertListInit(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count < 2)
 				return (null, SpecialType.UnknownType);
@@ -978,7 +978,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (BuildBlock, ctor.DeclaringType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertLogicOperator(CallInstruction invocation, bool and)
+		(Func<ILInstruction>?, IType) ConvertLogicOperator(CallInstruction invocation, bool and)
 		{
 			if (invocation.Arguments.Count < 2)
 				return (null, SpecialType.UnknownType);
@@ -1016,7 +1016,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			}
 		}
 
-		(Func<ILInstruction>, IType) ConvertMemberInit(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertMemberInit(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 2)
 				return (null, SpecialType.UnknownType);
@@ -1064,7 +1064,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (BuildBlock, ctor.DeclaringType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertNewArrayBounds(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertNewArrayBounds(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 2)
 				return (null, SpecialType.UnknownType);
@@ -1085,7 +1085,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (() => new NewArr(type, indices.SelectArray(f => f())), new ArrayType(context.TypeSystem, type, arguments.Count));
 		}
 
-		(Func<ILInstruction>, IType) ConvertNewArrayInit(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertNewArrayInit(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 2)
 				return (null, SpecialType.UnknownType);
@@ -1154,7 +1154,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			}
 		}
 
-		(Func<ILInstruction>, IType) ConvertNewObject(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertNewObject(CallInstruction invocation)
 		{
 			switch (invocation.Arguments.Count)
 			{
@@ -1203,7 +1203,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (null, SpecialType.UnknownType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertNotOperator(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertNotOperator(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count < 1)
 				return (null, SpecialType.UnknownType);
@@ -1229,7 +1229,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			}
 		}
 
-		(Func<ILInstruction>, IType) ConvertProperty(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertProperty(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count < 2)
 				return (null, SpecialType.UnknownType);
@@ -1272,7 +1272,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (BuildProperty, member.ReturnType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertTypeAs(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertTypeAs(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 2)
 				return (null, SpecialType.UnknownType);
@@ -1293,7 +1293,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (BuildTypeAs, type);
 		}
 
-		(Func<ILInstruction>, IType) ConvertTypeIs(CallInstruction invocation)
+		(Func<ILInstruction>?, IType) ConvertTypeIs(CallInstruction invocation)
 		{
 			if (invocation.Arguments.Count != 2)
 				return (null, SpecialType.UnknownType);
@@ -1306,7 +1306,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
 			return (null, SpecialType.UnknownType);
 		}
 
-		(Func<ILInstruction>, IType) ConvertUnaryNumericOperator(CallInstruction invocation, BinaryNumericOperator op, bool? isChecked = null)
+		(Func<ILInstruction>?, IType) ConvertUnaryNumericOperator(CallInstruction invocation, BinaryNumericOperator op, bool? isChecked = null)
 		{
 			if (invocation.Arguments.Count < 1)
 				return (null, SpecialType.UnknownType);
diff --git a/ICSharpCode.Decompiler/TypeSystem/GenericContext.cs b/ICSharpCode.Decompiler/TypeSystem/GenericContext.cs
index ddb41c94e..152175399 100644
--- a/ICSharpCode.Decompiler/TypeSystem/GenericContext.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/GenericContext.cs
@@ -25,10 +25,10 @@ namespace ICSharpCode.Decompiler.TypeSystem
 {
 	public readonly struct GenericContext
 	{
-		public readonly IReadOnlyList<ITypeParameter> ClassTypeParameters;
-		public readonly IReadOnlyList<ITypeParameter> MethodTypeParameters;
+		public readonly IReadOnlyList<ITypeParameter>? ClassTypeParameters;
+		public readonly IReadOnlyList<ITypeParameter>? MethodTypeParameters;
 
-		public GenericContext(IReadOnlyList<ITypeParameter> classTypeParameters)
+		public GenericContext(IReadOnlyList<ITypeParameter>? classTypeParameters)
 		{
 			this.ClassTypeParameters = classTypeParameters;
 			this.MethodTypeParameters = null;
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/DecoratedType.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/DecoratedType.cs
index 5107044f2..5e9f1a587 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/DecoratedType.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/DecoratedType.cs
@@ -44,12 +44,12 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 
 		public abstract bool Equals(IType other);
 
-		IEnumerable<IMethod> IType.GetAccessors(Predicate<IMethod> filter, GetMemberOptions options)
+		IEnumerable<IMethod> IType.GetAccessors(Predicate<IMethod>? filter, GetMemberOptions options)
 		{
 			return baseType.GetAccessors(filter, options);
 		}
 
-		IEnumerable<IMethod> IType.GetConstructors(Predicate<IMethod> filter, GetMemberOptions options)
+		IEnumerable<IMethod> IType.GetConstructors(Predicate<IMethod>? filter, GetMemberOptions options)
 		{
 			return baseType.GetConstructors(filter, options);
 		}
@@ -64,42 +64,42 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			return baseType.GetDefinitionOrUnknown();
 		}
 
-		IEnumerable<IEvent> IType.GetEvents(Predicate<IEvent> filter, GetMemberOptions options)
+		IEnumerable<IEvent> IType.GetEvents(Predicate<IEvent>? filter, GetMemberOptions options)
 		{
 			return baseType.GetEvents(filter, options);
 		}
 
-		IEnumerable<IField> IType.GetFields(Predicate<IField> filter, GetMemberOptions options)
+		IEnumerable<IField> IType.GetFields(Predicate<IField>? filter, GetMemberOptions options)
 		{
 			return baseType.GetFields(filter, options);
 		}
 
-		IEnumerable<IMember> IType.GetMembers(Predicate<IMember> filter, GetMemberOptions options)
+		IEnumerable<IMember> IType.GetMembers(Predicate<IMember>? filter, GetMemberOptions options)
 		{
 			return baseType.GetMembers(filter, options);
 		}
 
-		IEnumerable<IMethod> IType.GetMethods(Predicate<IMethod> filter, GetMemberOptions options)
+		IEnumerable<IMethod> IType.GetMethods(Predicate<IMethod>? filter, GetMemberOptions options)
 		{
 			return baseType.GetMethods(filter, options);
 		}
 
-		IEnumerable<IMethod> IType.GetMethods(IReadOnlyList<IType> typeArguments, Predicate<IMethod> filter, GetMemberOptions options)
+		IEnumerable<IMethod> IType.GetMethods(IReadOnlyList<IType> typeArguments, Predicate<IMethod>? filter, GetMemberOptions options)
 		{
 			return baseType.GetMethods(typeArguments, filter, options);
 		}
 
-		IEnumerable<IType> IType.GetNestedTypes(Predicate<ITypeDefinition> filter, GetMemberOptions options)
+		IEnumerable<IType> IType.GetNestedTypes(Predicate<ITypeDefinition>? filter, GetMemberOptions options)
 		{
 			return baseType.GetNestedTypes(filter, options);
 		}
 
-		IEnumerable<IType> IType.GetNestedTypes(IReadOnlyList<IType> typeArguments, Predicate<ITypeDefinition> filter, GetMemberOptions options)
+		IEnumerable<IType> IType.GetNestedTypes(IReadOnlyList<IType> typeArguments, Predicate<ITypeDefinition>? filter, GetMemberOptions options)
 		{
 			return baseType.GetNestedTypes(typeArguments, filter, options);
 		}
 
-		IEnumerable<IProperty> IType.GetProperties(Predicate<IProperty> filter, GetMemberOptions options)
+		IEnumerable<IProperty> IType.GetProperties(Predicate<IProperty>? filter, GetMemberOptions options)
 		{
 			return baseType.GetProperties(filter, options);
 		}
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/FakeMember.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/FakeMember.cs
index ca9b556d7..13426414a 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/FakeMember.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/FakeMember.cs
@@ -18,6 +18,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Collections.Immutable;
 using System.Reflection;
 using System.Reflection.Metadata;
 
@@ -94,7 +95,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 
 		string INamedElement.Namespace => DeclaringType?.Namespace;
 
-		bool IMember.Equals(IMember obj, TypeVisitor typeNormalization)
+		bool IMember.Equals(IMember? obj, TypeVisitor typeNormalization)
 		{
 			return Equals(obj);
 		}
@@ -152,10 +153,10 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 
 		bool IMethod.HasBody => false;
 		public bool IsAccessor => AccessorOwner is not null;
-		public IMember AccessorOwner { get; set; }
+		public IMember? AccessorOwner { get; set; }
 		public MethodSemanticsAttributes AccessorKind { get; set; }
 
-		IMethod IMethod.ReducedFrom => null;
+		IMethod? IMethod.ReducedFrom => null;
 
 		public IReadOnlyList<IParameter> Parameters { get; set; } = EmptyList<IParameter>.Instance;
 
@@ -195,11 +196,11 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 
 		public bool CanGet => Getter is not null;
 		public bool CanSet => Setter is not null;
-		public IMethod Getter { get; set; }
-		public IMethod Setter { get; set; }
+		public IMethod? Getter { get; set; }
+		public IMethod? Setter { get; set; }
 		public bool IsIndexer { get; set; }
 		public bool ReturnTypeIsRefReadOnly => false;
-		public IReadOnlyList<IParameter> Parameters { get; set; }
+		public IReadOnlyList<IParameter> Parameters { get; set; } = ImmutableArray<IParameter>.Empty;
 
 		public override string ToString() =>
 			"FakeProperty " + ReturnType + " " + DeclaringType.Name + "." + Name +
@@ -226,8 +227,8 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 		public bool CanAdd => AddAccessor is not null;
 		public bool CanRemove => RemoveAccessor is not null;
 		public bool CanInvoke => InvokeAccessor is not null;
-		public IMethod AddAccessor { get; set; }
-		public IMethod RemoveAccessor { get; set; }
-		public IMethod InvokeAccessor { get; set; }
+		public IMethod? AddAccessor { get; set; }
+		public IMethod? RemoveAccessor { get; set; }
+		public IMethod? InvokeAccessor { get; set; }
 	}
 }
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataEvent.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataEvent.cs
index 023276071..d7f1be94b 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataEvent.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataEvent.cs
@@ -164,7 +164,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 		public string ReflectionName => $"{DeclaringType?.ReflectionName}.{Name}";
 		public string Namespace => DeclaringType?.Namespace ?? string.Empty;
 
-		public override bool Equals(object obj)
+		public override bool Equals(object? obj)
 		{
 			if (obj is MetadataEvent ev)
 			{
@@ -178,7 +178,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			return 0x7937039a ^ module.MetadataFile.GetHashCode() ^ handle.GetHashCode();
 		}
 
-		bool IMember.Equals(IMember obj, TypeVisitor typeNormalization)
+		bool IMember.Equals(IMember? obj, TypeVisitor typeNormalization)
 		{
 			return Equals(obj);
 		}
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataField.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataField.cs
index 4486c90f5..3970ea97c 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataField.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataField.cs
@@ -258,7 +258,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			}
 		}
 
-		public object GetConstantValue(bool throwOnInvalidMetadata)
+		public object? GetConstantValue(bool throwOnInvalidMetadata)
 		{
 			object val = LazyInit.VolatileRead(ref this.constantValue);
 			if (val != null)
@@ -295,7 +295,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			}
 		}
 
-		public override bool Equals(object obj)
+		public override bool Equals(object? obj)
 		{
 			if (obj is MetadataField f)
 			{
@@ -309,7 +309,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			return 0x11dda32b ^ module.MetadataFile.GetHashCode() ^ handle.GetHashCode();
 		}
 
-		bool IMember.Equals(IMember obj, TypeVisitor typeNormalization)
+		bool IMember.Equals(IMember? obj, TypeVisitor typeNormalization)
 		{
 			return Equals(obj);
 		}
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs
index a40902510..d81e86d3d 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs
@@ -130,7 +130,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 
 		public bool HasBody => module.metadata.GetMethodDefinition(handle).HasBody();
 
-		public IMember AccessorOwner {
+		public IMember? AccessorOwner {
 			get {
 				if (accessorOwner.IsNil)
 					return null;
@@ -294,7 +294,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 		}
 
 		IMember IMember.MemberDefinition => this;
-		IMethod IMethod.ReducedFrom => null;
+		IMethod? IMethod.ReducedFrom => null;
 		TypeParameterSubstitution IMember.Substitution => TypeParameterSubstitution.Identity;
 
 		public ITypeDefinition DeclaringTypeDefinition {
@@ -602,7 +602,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 		public string ReflectionName => $"{DeclaringType?.ReflectionName}.{Name}";
 		public string Namespace => DeclaringType?.Namespace ?? string.Empty;
 
-		public override bool Equals(object obj)
+		public override bool Equals(object? obj)
 		{
 			if (obj is MetadataMethod m)
 			{
@@ -616,7 +616,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			return 0x5a00d671 ^ module.MetadataFile.GetHashCode() ^ handle.GetHashCode();
 		}
 
-		bool IMember.Equals(IMember obj, TypeVisitor typeNormalization)
+		bool IMember.Equals(IMember? obj, TypeVisitor typeNormalization)
 		{
 			return Equals(obj);
 		}
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataProperty.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataProperty.cs
index da2d8a4cf..70e24e735 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataProperty.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataProperty.cs
@@ -298,7 +298,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 		public string ReflectionName => $"{DeclaringType?.ReflectionName}.{Name}";
 		public string Namespace => DeclaringType?.Namespace ?? string.Empty;
 
-		public override bool Equals(object obj)
+		public override bool Equals(object? obj)
 		{
 			if (obj is MetadataProperty p)
 			{
@@ -312,7 +312,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			return 0x32b6a76c ^ module.MetadataFile.GetHashCode() ^ handle.GetHashCode();
 		}
 
-		bool IMember.Equals(IMember obj, TypeVisitor typeNormalization)
+		bool IMember.Equals(IMember? obj, TypeVisitor typeNormalization)
 		{
 			return Equals(obj);
 		}
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs
index 9d3b2fdc4..a020f991b 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataTypeDefinition.cs
@@ -549,7 +549,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			return this;
 		}
 
-		public override bool Equals(object obj)
+		public override bool Equals(object? obj)
 		{
 			if (obj is MetadataTypeDefinition td)
 			{
@@ -563,7 +563,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			return 0x2e0520f2 ^ module.MetadataFile.GetHashCode() ^ handle.GetHashCode();
 		}
 
-		bool IEquatable<IType>.Equals(IType other)
+		bool IEquatable<IType>.Equals(IType? other)
 		{
 			return Equals(other);
 		}
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs
index 4f1b9cc8a..11740ab7d 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MinimalCorlib.cs
@@ -62,13 +62,13 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 		string ISymbol.Name => "corlib";
 		SymbolKind ISymbol.SymbolKind => SymbolKind.Module;
 
-		Metadata.MetadataFile IModule.MetadataFile => null;
+		Metadata.MetadataFile? IModule.MetadataFile => null;
 		INamespace IModule.RootNamespace => rootNamespace;
 
 		public IEnumerable<ITypeDefinition> TopLevelTypeDefinitions => typeDefinitions.Where(td => td != null);
 		public IEnumerable<ITypeDefinition> TypeDefinitions => TopLevelTypeDefinitions;
 
-		public ITypeDefinition GetTypeDefinition(TopLevelTypeName topLevelTypeName)
+		public ITypeDefinition? GetTypeDefinition(TopLevelTypeName topLevelTypeName)
 		{
 			foreach (var typeDef in typeDefinitions)
 			{
@@ -105,11 +105,11 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 		{
 			readonly MinimalCorlib corlib;
 			internal List<INamespace> childNamespaces = new List<INamespace>();
-			public INamespace ParentNamespace { get; }
+			public INamespace? ParentNamespace { get; }
 			public string FullName { get; }
 			public string Name { get; }
 
-			public CorlibNamespace(MinimalCorlib corlib, INamespace parentNamespace, string fullName, string name)
+			public CorlibNamespace(MinimalCorlib corlib, INamespace? parentNamespace, string fullName, string name)
 			{
 				this.corlib = corlib;
 				this.ParentNamespace = parentNamespace;
@@ -127,7 +127,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			SymbolKind ISymbol.SymbolKind => SymbolKind.Namespace;
 			ICompilation ICompilationProvider.Compilation => corlib.Compilation;
 
-			INamespace INamespace.GetChildNamespace(string name)
+			INamespace? INamespace.GetChildNamespace(string name)
 			{
 				return childNamespaces.FirstOrDefault(ns => ns.Name == name);
 			}
@@ -148,7 +148,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			{
 				this.corlib = corlib;
 				this.typeCode = typeCode;
-				KnownTypeReference ktr = KnownTypeReference.Get(typeCode);
+				KnownTypeReference? ktr = KnownTypeReference.Get(typeCode);
 				this.typeKind = ktr.typeKind;
 				this.MetadataName = ktr.Name + (ktr.TypeParameterCount > 0 ? "`" + ktr.TypeParameterCount : "");
 			}
@@ -168,10 +168,10 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 
 			public string MetadataName { get; }
 
-			ITypeDefinition IEntity.DeclaringTypeDefinition => null;
-			IType ITypeDefinition.DeclaringType => null;
-			IType IType.DeclaringType => null;
-			IType IEntity.DeclaringType => null;
+			ITypeDefinition? IEntity.DeclaringTypeDefinition => null;
+			IType? ITypeDefinition.DeclaringType => null;
+			IType? IType.DeclaringType => null;
+			IType? IEntity.DeclaringType => null;
 
 			bool ITypeDefinition.HasExtensionMethods => false;
 			bool ITypeDefinition.IsReadOnly => false;
@@ -248,61 +248,61 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 
 			string INamedElement.Namespace => KnownTypeReference.Get(typeCode).Namespace;
 
-			bool IEquatable<IType>.Equals(IType other)
+			bool IEquatable<IType>.Equals(IType? other)
 			{
 				return this == other;
 			}
 
-			IEnumerable<IMethod> IType.GetAccessors(Predicate<IMethod> filter, GetMemberOptions options)
+			IEnumerable<IMethod> IType.GetAccessors(Predicate<IMethod>? filter, GetMemberOptions options)
 			{
 				return EmptyList<IMethod>.Instance;
 			}
 
 			IEnumerable<IAttribute> IEntity.GetAttributes() => EmptyList<IAttribute>.Instance;
 			bool IEntity.HasAttribute(KnownAttribute attribute) => false;
-			IAttribute IEntity.GetAttribute(KnownAttribute attribute) => null;
+			IAttribute? IEntity.GetAttribute(KnownAttribute attribute) => null;
 
-			IEnumerable<IMethod> IType.GetConstructors(Predicate<IMethod> filter, GetMemberOptions options)
+			IEnumerable<IMethod> IType.GetConstructors(Predicate<IMethod>? filter, GetMemberOptions options)
 			{
 				return EmptyList<IMethod>.Instance;
 			}
 
-			IEnumerable<IEvent> IType.GetEvents(Predicate<IEvent> filter, GetMemberOptions options)
+			IEnumerable<IEvent> IType.GetEvents(Predicate<IEvent>? filter, GetMemberOptions options)
 			{
 				return EmptyList<IEvent>.Instance;
 			}
 
-			IEnumerable<IField> IType.GetFields(Predicate<IField> filter, GetMemberOptions options)
+			IEnumerable<IField> IType.GetFields(Predicate<IField>? filter, GetMemberOptions options)
 			{
 				return EmptyList<IField>.Instance;
 			}
 
-			IEnumerable<IMember> IType.GetMembers(Predicate<IMember> filter, GetMemberOptions options)
+			IEnumerable<IMember> IType.GetMembers(Predicate<IMember>? filter, GetMemberOptions options)
 			{
 				return EmptyList<IMember>.Instance;
 			}
 
-			IEnumerable<IMethod> IType.GetMethods(Predicate<IMethod> filter, GetMemberOptions options)
+			IEnumerable<IMethod> IType.GetMethods(Predicate<IMethod>? filter, GetMemberOptions options)
 			{
 				return EmptyList<IMethod>.Instance;
 			}
 
-			IEnumerable<IMethod> IType.GetMethods(IReadOnlyList<IType> typeArguments, Predicate<IMethod> filter, GetMemberOptions options)
+			IEnumerable<IMethod> IType.GetMethods(IReadOnlyList<IType> typeArguments, Predicate<IMethod>? filter, GetMemberOptions options)
 			{
 				return EmptyList<IMethod>.Instance;
 			}
 
-			IEnumerable<IType> IType.GetNestedTypes(Predicate<ITypeDefinition> filter, GetMemberOptions options)
+			IEnumerable<IType> IType.GetNestedTypes(Predicate<ITypeDefinition>? filter, GetMemberOptions options)
 			{
 				return EmptyList<IType>.Instance;
 			}
 
-			IEnumerable<IType> IType.GetNestedTypes(IReadOnlyList<IType> typeArguments, Predicate<ITypeDefinition> filter, GetMemberOptions options)
+			IEnumerable<IType> IType.GetNestedTypes(IReadOnlyList<IType> typeArguments, Predicate<ITypeDefinition>? filter, GetMemberOptions options)
 			{
 				return EmptyList<IType>.Instance;
 			}
 
-			IEnumerable<IProperty> IType.GetProperties(Predicate<IProperty> filter, GetMemberOptions options)
+			IEnumerable<IProperty> IType.GetProperties(Predicate<IProperty>? filter, GetMemberOptions options)
 			{
 				return EmptyList<IProperty>.Instance;
 			}
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/NullabilityAnnotatedType.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/NullabilityAnnotatedType.cs
index abfd5b184..63b9d5085 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/NullabilityAnnotatedType.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/NullabilityAnnotatedType.cs
@@ -34,7 +34,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			return visitor.VisitNullabilityAnnotatedType(this);
 		}
 
-		public override bool Equals(IType other)
+		public override bool Equals(IType? other)
 		{
 			return other is NullabilityAnnotatedType nat
 				&& nat.nullability == nullability
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/SyntheticRangeIndexer.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/SyntheticRangeIndexer.cs
index 2bc60031e..8c0072e2d 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/SyntheticRangeIndexer.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/SyntheticRangeIndexer.cs
@@ -105,7 +105,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 		string INamedElement.ReflectionName => underlyingMethod.ReflectionName;
 		string INamedElement.Namespace => underlyingMethod.Namespace;
 
-		public override bool Equals(object obj)
+		public override bool Equals(object? obj)
 		{
 			return obj is SyntheticRangeIndexAccessor g
 				&& this.underlyingMethod.Equals(g.underlyingMethod)
@@ -118,7 +118,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
 			return underlyingMethod.GetHashCode() ^ indexOrRangeType.GetHashCode();
 		}
 
-		bool IMember.Equals(IMember obj, TypeVisitor typeNormalization)
+		bool IMember.Equals(IMember? obj, TypeVisitor typeNormalization)
 		{
 			return obj is SyntheticRangeIndexAccessor g
 				&& this.underlyingMethod.Equals(g.underlyingMethod, typeNormalization)
diff --git a/ICSharpCode.Decompiler/Util/LazyInit.cs b/ICSharpCode.Decompiler/Util/LazyInit.cs
index d19344cd4..77589b46f 100644
--- a/ICSharpCode.Decompiler/Util/LazyInit.cs
+++ b/ICSharpCode.Decompiler/Util/LazyInit.cs
@@ -35,7 +35,7 @@ namespace ICSharpCode.Decompiler.Util
 		/// - If target is not null: returns target.
 		/// </summary>
 		[return: NotNullIfNotNull("newValue")]
-		public static T? GetOrSet<T>(ref T? target, T? newValue) where T : class
+		public static T? GetOrSet<T>([NotNullIfNotNull(nameof(newValue))] ref T? target, T? newValue) where T : class
 		{
 			T? oldValue = Interlocked.CompareExchange(ref target, newValue, null);
 			return oldValue ?? newValue;