Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 12:28
    mysticmind labeled #1568
  • 12:28
    mysticmind commented #1568
  • 12:18
    kasparurban commented #1568
  • Oct 23 09:08
    srasch edited #1588
  • Oct 23 09:07
    srasch synchronize #1588
  • Oct 23 09:05
    srasch synchronize #1588
  • Oct 23 08:56
    dnfadmin commented #1588
  • Oct 23 08:54
    dnfadmin commented #1588
  • Oct 23 08:54
    srasch opened #1588
  • Oct 22 22:06
    dnfadmin commented #1587
  • Oct 22 22:05
    markjerz commented #1582
  • Oct 22 22:04
    dnfadmin commented #1587
  • Oct 22 22:04
    markjerz opened #1587
  • Oct 22 20:03

    oskardudycz on merge_3_x_to_master

    (compare)

  • Oct 22 20:03

    oskardudycz on master

    Introduce DefaultRetryPolicy (#… (compare)

  • Oct 22 20:03
    oskardudycz closed #1586
  • Oct 22 19:14
    oskardudycz synchronize #1586
  • Oct 22 19:14

    oskardudycz on merge_3_x_to_master

    Introduce DefaultRetryPolicy (#… (compare)

  • Oct 22 19:08
    oskardudycz opened #1586
  • Oct 22 19:08

    oskardudycz on merge_3_x_to_master

    Introduce DefaultRetryPolicy (#… (compare)

TarunKumarG
@TarunKumarG
Thanks,
Jeremy D. Miller
@jeremydmiller
@TarunKumarG It’s clearly not registered, or you wouldn’t be getting that exception
TarunKumarG
@TarunKumarG
Even we thought the same, but these depedencies were registered in the nuget packages that we were referring to
if they were already registered in the package itself, why there is a need to register them in the project that the package is used.
@jeremydmiller
Jeremy D. Miller
@jeremydmiller
Not in the StructureMap container you’re actually using. Have you checked the WhatDoIHave() diagnostics to verify that?
TarunKumarG
@TarunKumarG
No, I didnt check WhatDoIHave(), let me check now .
CarlosOnline
@CarlosOnline

Looking to use StructureMap in Azure Function to do multi tenancy. Found a sample that replaces the ServiceProvider in a Web Api (4 years old), wondering if that approach would work for Azure Functions.

Also is there a recent sample that works with .net core 3.1 Azure Functions?

Mark Warpool
@CodingGorilla
@CarlosOnline Consider using https://github.com/jasperfx/lamar instead, it's the official replacement for StructureMap. Although I can't speak to how it would work with Azure functions (haven't tried it).
TarunKumarG
@TarunKumarG
@jeremydmiller , i just verified with WhatDoIHave(), i have the dependencies which are needed in the container, but why it is explicitly asking us to register again ?
please suggest
Jeremy D. Miller
@jeremydmiller
I don’t know to be honest. There’s something else going on I can’t see.
TarunKumarG
@TarunKumarG
ok, Can anyone give any suggestions
Mark Warpool
@CodingGorilla
@TarunKumarG How does it "ask us to register again"?
TarunKumarG
@TarunKumarG
@CodingGorilla
i dont why but it is throwing below exception

Issue/Exception:
StructureMap.StructureMapConfigurationException: No default Instance is registered and cannot be automatically determined for type 'HM.Disco.PurchaseProduct.DataProviders.IPurchaseProductDataProvider'

There is no configuration specified for HM.Disco.PurchaseProduct.DataProviders.IPurchaseProductDataProvider

1.) new PreAdvicesApprovedEventHandler(Default of IPurchaseProductDataProvider, Default of ISecurityDataProvider, Default of IHmOrderUpdater, Default of IHmOrderUpdateEmailComposer, Default of IFeatureAccessManager)
2.) HM.Disco.ItOps.Gateway.HMOrder.PreAdvicesApprovedEventHandler
3.) Instance of HM.Disco.ItOps.Gateway.HMOrder.PreAdvicesApprovedEventHandler
4.) Container.GetInstance(HM.Disco.ItOps.Gateway.HMOrder.PreAdvicesApprovedEventHandler)

Jeremy D. Miller
@jeremydmiller
“cannot be automatically determined for type “ — might be the key thing there. Whatever that service is, does SM have all its dependencies? It might not be able to determine a usable constructor function
yuren1978
@yuren1978
Hello, we are using nested container in asp.net webapi (NOT .net core), and we are seeing ObjectDisposedException("StructureMap Nested Container") in the middle of http request, does anybody has any idea what will cause that.
we are using structure map through out the application, but it does seem only happening at one particular call, I don't see how this call is different with other calls, by the way, this only happens under the load.
we have tried to upgrade to latest version of structure map, and still seeing the same issue.
yuren1978
@yuren1978
Here is the exact error : Cannot access a disposed object. Object name: 'StructureMap Nested Container'. StackTrace: at StructureMap.Container.assertNotDisposed() at StructureMap.Container.GetInstanceT at * our application code.
Jeremy D. Miller
@jeremydmiller
Something is hanging on to the nested container when it shouldn’t be. Are you injecting the IContainer into something?
yuren1978
@yuren1978
yes, we inject into constructructor , so it can be used to resolve other instance with _container.GetInstance, and it's where it bombs, is this not the right way of doing it?
yuren1978
@yuren1978
There is a shared document library we use which takes IContainer in constructor, and we subsequently use that injected container to resolve other object
Ben Collins
@aggieben
I'm having some trouble getting .Inject() to work like I think it should with SM 4.7, and I was wondering if anyone here could offer some insight. For some reason, it appears as though child.Inject has no effect at all. I have a linqpad script here: https://gist.github.com/aggieben/a389b01b7ba637a265299c1b2f9337d0
Ben Collins
@aggieben
I'm still playing around with examples, but here's a pretty good simple repro:
public void TestSimpleDependency()
{
    /*
        Dependency hierarchy:
            IFooRepository
                => IFoo
    */

    var container = new Container(cfg =>
    {
       cfg.For<IFoo>().Singleton().Use<Foo>();
       cfg.For<IFooRepository>().Singleton().Use<FooRepository>();
    });

    var child = container.CreateChildContainer();

    var substituteFoo = Substitute.For<IFoo>();
    child.Inject(substituteFoo);

    var fooRepo = child.GetInstance<IFooRepository>();
    fooRepo.Foo.Should().BeSameAs(substituteFoo); // fails assertion here
}
Jeremy D. Miller
@jeremydmiller
I’d guess that the bug is due to the foo repository being a singleton. YOu might try it ContainerScoped() instead
Ben Collins
@aggieben
hmm. if I configure IFooRepository repository like this: cfg.For<IFooRepository>().ConatinerScoped().Use<FooRepository>(), then the test works
I also tested it with child.EjectAllInstances<IFooRepository>() in the singleton case, and it still failed
my problem here is that I'm going to be stuck with using singletons; that's not something I can change in the real code :-(
Jeremy D. Miller
@jeremydmiller
And this is also the time when I remind you that StructureMap is no longer supported and I’m encouraging folks to move to Lamar
And this kind of issue is a good example of why I wanted out of supporting SM:(
Ben Collins
@aggieben
yeah. I wish I could, but I'm also stuck on that count as well, at least for the time being

And this kind of issue is a good example of why I wanted out of supporting SM:(

completely understand. I feel the same about the production code I'm trying to write tests for

Ben Collins
@aggieben
@jeremydmiller thanks for the tip on ContainerScoped. That might actually be good enough to get me out of my predicament