When executing using Test With > In-Proc (VS SDK), the imported ICompositionService doesn't include the target components.
For example, the following will fail:
[Export]
public class Foo
{
readonly ICompositionService compositionService;
[ImportingConstructor]
public Foo(ICompositionService compositionService)
{
this.compositionService = compositionService;
}
public void Compose()
{
var bar = new Bar();
compositionService.SatisfyImportsOnce(bar);
}
class Bar
{
[Import]
public Foo Foo { get; set; }
}
}
System.ComponentModel.Composition.CompositionException: The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.
1) No exports were found that match the constraint:
ContractName GitHub.VisualStudio.Contrib.Console.Foo
RequiredTypeIdentity GitHub.VisualStudio.Contrib.Console.Foo
Resulting in: Cannot set import 'GitHub.VisualStudio.Contrib.Console.Foo+Bar.Foo (ContractName="GitHub.VisualStudio.Contrib.Console.Foo")' on part 'GitHub.VisualStudio.Contrib.Console.Foo+Bar'.
Element: GitHub.VisualStudio.Contrib.Console.Foo+Bar.Foo (ContractName="GitHub.VisualStudio.Contrib.Console.Foo") --> GitHub.VisualStudio.Contrib.Console.Foo+Bar
When executing using
Test With > In-Proc (VS SDK)
, the importedICompositionService
doesn't include the target components.For example, the following will fail: