Giter Site home page Giter Site logo

Comments (4)

GeertvanHorrik avatar GeertvanHorrik commented on June 11, 2024

Thanks for reporting. Is there a way you can provide this in a (failing) unit test format? Then we can try to embed the tests into catel and fix if possible.

from catel.

PatrickKursawe avatar PatrickKursawe commented on June 11, 2024

Will try to cook something up when I am done with removing that default constructor.

from catel.

PatrickKursawe avatar PatrickKursawe commented on June 11, 2024

Unfortunately, I can't reproduce the issue in a simplified test case, so maybe close this issue?

Looking at the catel source, though, something seems a little odd to me:

In ServiceLocatorExtensions.TryResolveType, the "this" (the service locator itself) is used as a lock object.
In ServiceLocator.IsTypeRegisteredInCurrentLocator, the dedicated internal lock object is used as a lock.
How can this result in a deadlock? Do you understand what is happening here?

What's the reason for locking in the extension method at all? That lock should not prevent anyone from removing the type between the check for registration and the attempt at object creation, as that method is using a different lock.
But this lock will result in a deadlock if some object that is created while resolving calls TryResolveType from a different thread in the constructor (for example because of GUI depending code). So, if you don't mind that I am wasting your time more than I already did, what scenario is the lock in the extension method supposed to avoid?
Thanks!

from catel.

GeertvanHorrik avatar GeertvanHorrik commented on June 11, 2024

Great find about the lock in the service locator. I've removed the lock (it's not needed). We also worked on a fix that was caused by the ConfigurationService (took us a while to figure out). We will release a new alpha with the fixes soon.

from catel.

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.