Skip to content

System.Composition.ImportAttribute cannot be used on fields #31041

@dnickless

Description

@dnickless

I am getting some compilation issue after updating an older codebase to System.Composition.

image

Is it possible that AttributeUsage.Field should be added to the declaration here?

https://github.com/dotnet/corefx/blob/dcc9f626eeb0751d4ba4499f623aac42d2e95c10/src/System.Composition.AttributedModel/src/System/Composition/ImportAttribute.cs#L13

The documentation on https://docs.microsoft.com/en-us/dotnet/api/system.composition.importattribute?view=dotnet-plat-ext-3.0 states:

Specifies that a property, field, or parameter value should be provided by the host container.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions