0

I'm in the process of migrating to StructureMap 4 (specifically version 4.0.1.318).

I have what looks to me like appropriate object registration:

For<ISomeInterface>().Use(() => GetConcreteInstance());
For<ISomeInterface>().MissingNamedInstanceIs.TheDefault();

For<ISomeOtherThing>().Add<OtherConcreteClass>()
    .Ctor<ISomeInterface>().IsNamedInstance("Special");

However, if no "Special" instance of ISomeInterface is configured (which would typically occur in another Registry, if it needs to happen), then rather than falling back to the default instance (which is what I would expect) a call like this

[Container].GetAllInstances<ISomeOtherThing>();

results in the following: System.NotSupportedException: Instance's of type 'StructureMap.Pipeline.DefaultInstance' does not support ToNamedClose() and cannot be used as a MissingInstance

I'm guessing something is wrong in my registration... but what?

Richard J Foster
  • 4,278
  • 2
  • 32
  • 41

1 Answers1

0

Based on a conversation with Jeremy Miller in StructureMap's Gitter IM channel, it seems as if this is an oversight in the current implementation, and is likely to be fixed shortly.

For anyone else needing it, the bug report can be found at https://github.com/structuremap/structuremap/issues/438

Richard J Foster
  • 4,278
  • 2
  • 32
  • 41