Skip to content

MEFv2 attributes make importing SAsyncServiceProvider hard #138

Description

@AArnott

In the following two MEF parts running in VS, the MEFv1Part gets both properties set to a non-null value, while the MEFv2Part only has the second property set to a non-null value.

Why is that? Is it by design of how MEFv2 attributes behave or a bug in VS-MEF?

        [MEFv1.Export]
        public class MEFv1Part
        {
            [MEFv1.Import(typeof(SAsyncServiceProvider), AllowDefault = true)]
            public Microsoft.VisualStudio.Shell.IAsyncServiceProvider AsyncServiceProvider { get; set; }

            [MEFv1.Import(typeof(SAsyncServiceProvider), AllowDefault = true)]
            public object AsyncServiceProvider3 { get; set; }
        }

        [MEFv2.Export]
        public class MEFv2Part
        {
            [MEFv2.Import("Microsoft.VisualStudio.Shell.Interop.SAsyncServiceProvider", AllowDefault = true)]
            public Microsoft.VisualStudio.Shell.IAsyncServiceProvider AsyncServiceProvider { get; set; }

            [MEFv2.Import("Microsoft.VisualStudio.Shell.Interop.SAsyncServiceProvider", AllowDefault = true)]
            public object AsyncServiceProvider3 { get; set; }
        }

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions