-
Notifications
You must be signed in to change notification settings - Fork 235
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
AutoRegister registers over 10k types when using in Xamarin.Forms #139
Comments
Have you done any profiling to see why it's taking so much time? |
You could also pass a predicate to AutoRegister to exclude anything in that assembly, and/or update IsIgnoredAssembly to ignore it (would be nice to add a public collection property that would let you add to that ignored assembly list). |
Does it seem like a bad practice to do auto registrations in general? |
Just wanted to add something to this. I was hacking the current TinyIOC.cs file with an older version of the file as reference that was working and found that by replacing registration region with the below snippet and updating the AutoRegisterInternal function with the older version of the function it no longer autoregisters the all the xf assemblys and seems to work. I haven't had a chance to investigate why yet the main difference seems to be how it handles the ignoreDuplicateImplementations within the registration. This is probably a classic case of me fuxing something (fixing one thing and breaking 20 other things in the process) but It might help you guys pin point the issue with XF. Updated Code #region Registration /// Attempt to automatically register all non-generic classes and interfaces in the current app domain. /// /// If more than one class implements an interface then only one implementation will be registered /// although no error will be thrown. /// public void AutoRegister() { AutoRegisterInternal(new Assembly[] { this.GetType().Assembly() }, true, null); }
private void AutoRegisterInternal(IEnumerable assemblies, bool ignoreDuplicateImplementations, Func<Type, bool> registrationPredicate)
|
AutoRegister takes ages (over 10 seconds to complete as it seems to register over 10,000 types.
For example see AutoRegister
The text was updated successfully, but these errors were encountered: