-
Notifications
You must be signed in to change notification settings - Fork 333
DefaultLoader.SearchForStartupAttribute get all assembly attribute instances during initialization #278
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
Comments
Feel free to send a PR. |
I see you did it for some reason 6 years ago, you also introduced Because logic here seems strange for me: if I introduced my own attribute with name OwinStartupAttribute it will work as a startup attribute. |
I'd forgotten about that. Yes it was intentionally type decoupled but I don't remember the reasoning. Best not to break that at this point though. What was your issue with loading the attributes? |
That is fine, this still can be used: https://docs.microsoft.com/en-us/dotnet/api/System.Reflection.Assembly.GetCustomAttributesData?view=netframework-4.5 My issue was that one assembly happened to be in bin folder does not have all dependencies, some of them were referenced in assembly level attributes. Thus trying to instantiate such an attribute will lead to AssemblyLoadException. |
Method DefaultLoader.SearchForStartupAttribute executes
customAttributes = referencedAssembly.GetCustomAttributes(false);
Which means instantiating of all assembly attributes (that is not necessary and can bring problems)
Can be replaced by
customAttributes = referencedAssembly.GetCustomAttributes<OwinStartupAttribute>(false);
or similar.
The text was updated successfully, but these errors were encountered: