Code Monkey home page Code Monkey logo

Comments (3)

citizenmatt avatar citizenmatt commented on June 3, 2024

I can't reproduce this using master or develop. Any steps to repro?

from agentmulder.

citizenmatt avatar citizenmatt commented on June 3, 2024

OK. Got it - I used a memory profiler. The problem is in the Ninject container's BindBasePattern. The code is checking to see if the current type implements Ninject's IBindingRoot interface, and to do so, it creates an instance of IDeclaredType and stores it in the class. The only problem is that the ComponentRegistration classes have the same lifetime as the shell, and the IDeclaredType instance has been created using an IPsiModule of the solution. This keeps the solution in scope, and so ReSharper complains.

When you re-open the solution (I bet it's a Ninject solution), the Ninject bindings are trying to match against a type representing IBindingRoot created with a different solution. I suspect that will fail.

You should be able to sort this by either not saving the created bindingRootType in a field, or by changing the call to IsDescendantOf to TypeElementUtil.GetAllSuperTypes and walk the returned list comparing fully qualified names. I haven't looked into the performance implications of either method...

from agentmulder.

hmemcpy avatar hmemcpy commented on June 3, 2024

Matt, have I mentioned how awesome you are?!? :)

It was indeed in a Ninject solution where I encountered this! Also, you have hit the nail on the head - that's exactly where the problem is!

I have refactored the entire hack that checks for the IBindingRoot into a helper extension (StructureMap needs the same check, as both Ninject and StructureMap have Module-like classes, where the methods (For<>, Bind<>, etc) are members of the class, and not prefixed with an instance. SSR currently doesn't match implicit 'this', that's why I require that check.

I have already removed the static field, I will try to make the changes as you suggested!

Thanks again so very much!

from agentmulder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.