Skip to content

Source generator doesn't see DefaultMemberAttribute #76965

Closed as not planned
Closed as not planned
@twsouthwick

Description

@twsouthwick

I'm exploring using source generators for sgen and need to get the default member for part of that. However, when the source generator runs, the INamedTypeSymbol has no custom attributes so it can't be found.

Version Used:
Visual Studio 17.12.4

Steps to Reproduce:

Here's a repro with an isolated example: https://github.com/twsouthwick/XmlSerializerGenerator/tree/no-default-repro

Go to the test-generator project. It is hooked up to run the source generator. It will attempt to grab the custom attributes from the type supplied to the MyAttr attribute. At runtime, there are 3 attributes (2 nullable contexts and the DefaultMemberAttribute); the source generator does not see any.

The source generator is here. It gets a type from an attribute and enumerates the custom attributes.

Note: duplicate of #73229 but that one has been closed so opening a new one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions