Skip to content

Commit 126dffe

Browse files
Fix #3364: Custom events and indexers can never have an initializer, so do not include them in the output for constructors.
1 parent ae77671 commit 126dffe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ILSpy/Languages/CSharpLanguage.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ public void Run(AstNode rootNode, TransformContext context)
222222
removedSymbols.Add(pd.GetSymbol());
223223
}
224224
break;
225+
case CustomEventDeclaration ced:
226+
case IndexerDeclaration id:
227+
node.Remove();
228+
removedSymbols.Add(node.GetSymbol());
229+
break;
225230
}
226231
}
227232
if (ctorDecl?.Initializer.ConstructorInitializerType == ConstructorInitializerType.This)
@@ -291,7 +296,7 @@ static List<EntityHandle> CollectFieldsAndCtors(ITypeDefinition type, bool isSta
291296
}
292297
foreach (var p in type.Properties)
293298
{
294-
if (!p.MetadataToken.IsNil && p.IsStatic == isStatic)
299+
if (!p.MetadataToken.IsNil && p.IsStatic == isStatic && !p.IsIndexer)
295300
members.Add(p.MetadataToken);
296301
}
297302
foreach (var ctor in type.Methods)

0 commit comments

Comments
 (0)