Skip to content
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

DefaultNamingSubSystem.InvalidateCache was protected and has been made private in 5.1.0 #566

Closed
Echtelion opened this issue Nov 20, 2020 · 8 comments · Fixed by #569
Closed
Labels
Milestone

Comments

@Echtelion
Copy link

Hello,
refer to #151

I'm sorry to reopen this old ticket, but the 5.0 version of windsor changed InvalidateCache to private.
It's also not possible to reimplement it in the derived method, because the fields are also made private and the property are protected read only. Ultimately, assignableHandlerListsByTypeCache is private with no protected accessor at all.

I can reimplement it with reflection, as I'm not using this method intensively, but is there a new recommended way to do this ?

Regards,

@nativenolde
Copy link
Contributor

nativenolde commented Nov 23, 2020

@generik0 Unfortunately, i am also affected by this change...

https://github.com/castleproject/Windsor/pull/556/files#diff-abfeffa5864abf0d2f22d3a8eb387e9742a306bb7309ad528b044b78da178b45

@Echtelion You can use that snippet as a workaround:

        private void InvalidateCacheUsingReflection()
        {
            const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
            var method = typeof(DefaultNamingSubSystem).GetMethod("InvalidateCache", flags);
            method.Invoke(this, null);
        }

@generik0
Copy link
Contributor

@Echtelion @nativenolde

Please tell me What the exact issue is.
It is private now, you where using in a derived cleans, and don't have access?

Is this also the issue for you @nativenolde just how it is exposed, or is there an
Issue withe the functionality of the change?

@Echtelion
Copy link
Author

The commit is for "Add InvalidateCache to DependencyInjectionNamingSubsystem", when it actually remove the ability to be called from others derived Subsystem.

The reason I'm using this method is for being able to unregister an instance. After removing it, I have to clear the cache in order to have the container behave normally.
I now have to drop the whole container and create a new one, instead of reusing an existing container. I managed to pass existing instances from old to new containers when possible, so I have a workaround.

@generik0
Copy link
Contributor

@Echtelion can you make a PR with the change you need to fix it?
Would a protected virtual help?

@Echtelion
Copy link
Author

Yes, a protected virtual will do the job.

Sorry, I'm not used to git, still under tfs

@generik0
Copy link
Contributor

generik0 commented Nov 23, 2020

Tfs has got ;-)
I can do it Wednesday, but it might take a bit before we can get on nuget...

@Echtelion
Copy link
Author

Thanks.

Not a problem for me, I have a workaround to wait, and in the worst case I can compile it myself.

@jonorossi jonorossi changed the title Remove component in CastleWindsor version > 5.0 DefaultNamingSubSystem.InvalidateCache was protected and has been made private in 5.1.0 Nov 24, 2020
@jonorossi jonorossi added the bug label Nov 24, 2020
@jonorossi jonorossi added this to the vNext milestone Nov 27, 2020
@jonorossi
Copy link
Member

Fixed by #569.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants