C
C#2y ago
kuba_z2

❔ Checking if ISymbol was autogenerated

Hello, is there any way to check if ISymbol was autogenerated by c# compiler? In this case checking for specialname attribute should be ok. I want to filter out autogenerated symbols such as methods generated from autoproperties or enums' value__ field.
10 Replies
kuba_z2
kuba_z2OP2y ago
no, it is false even though a method is generated from autoproperty and also for value__ field for enums
Aaron
Aaron2y ago
the CompilerGenerated attribute?
kuba_z2
kuba_z2OP2y ago
it's not being added to the symbols by the compiler please, can someone help?
Anton
Anton2y ago
For IFieldSymbol, there's the AssociatedSymbol For IMethodSymbol there should probably be one as well If that's not null, it's compiler generated
kuba_z2
kuba_z2OP2y ago
it's null for value__ for enums
kuba_z2
kuba_z2OP2y ago
it seems to work for autoproperties nice thanks @AntonC, now only handling value__ for enums is left
Anton
Anton2y ago
you can probably check if the type it's defined in is an enum or something like that make a special case for enums
kuba_z2
kuba_z2OP2y ago
yeah, I was thinking about it, thanks
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server