-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect circular dependencies among resources #714
Conversation
Make solely cosmetic changes to the class.
and an accompanying test
src/DotVVM.Framework.Tests.Common/ResourceManagement/ResourceRepositoryTests.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first commit merely satisfies my OCD. It's the second one that needs attention.
Please don't, the same explanation as in the other PR applies - it does not really do anything for readability and pollutes history.
Anyways, the check works, but only with a the assumption that the resource dependencies are not liable, which is unfortunately not the case. I think we should keep this check you just implemented and add a second one to the point when the resources are ordered in the render phase.
@exyi History unpolluted. There's something I don't understand though. How exactly can it break in the render phase if the user is not able to register resources with circular dependencies? Wouldn't the check slow down the render phase? |
How exactly can it break in the render phase if the user is not able to register resources with
circular dependencies? Wouldn't the check slow down the render phase?
The problem is that the `Dependencies` property is mutable, so I can
register a resource without any dependency and create the cycle later.
Unfortunatelly we certainly can't remove that setter as it would break
most usages.
|
I think that there would be many cases like that because many things in the configuration is mutable. |
I added a check to the point where resources are ordered and to the |
and use HashSet<IResource> instead
Fixes #710.
The first commit merely satisfies my OCD. It's the second one that needs attention.