-
-
Notifications
You must be signed in to change notification settings - Fork 837
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
Null reference when injecting page properties on Page.Title? #799
Comments
Page.Title
?
Should this be in the |
I think this repo is fine; I'm guessing it has something to do with the updated property injection behavior we added in 4.0. I was able to reproduce the issue. My current hypothesis is that the previous property injection handling caught exceptions during "get" operations and handled it. Going to have to research it a bit. |
Verified that the code in the Page.Title property is the same between version 2.0.0.0 and 4.0.0.0 of System.Web (at least in my machine's GAC). So... nothing's changed there. |
This is a defect in our new property injection mechanism. In the old version, we checked to see if we could supply the value before we looked at the property to see if we needed to inject it. Since the page title is a string and most folks don't have string registered we never ran into any issues. Of course, in the very rare case where someone had string registered, they'd have hit this. In the new version, we check to see if the property is something we should inject before looking to see if the object type can be resolved or if there's a parameter for the property. Which means, in the So, basically, we just sort of got lucky in the previous version that getting a property that needed to be checked during I think the solution to this is to wrap the "get" operation in a try/catch and ignoring the property if it throws. If we can't check if it's unset, we assume it's set and move on. |
Fix included in v4.1.1, pushed to NuGet. |
Wow, that was fast! Thank you! |
Please see: http://stackoverflow.com/questions/25534755/why-cant-i-get-the-page-title-within-an-httpmodule
When Autofac tries to inject properties into a given page, I get the following error because of it:
It seems to be related to Autofac attempting to read
Page.Title
to see if it is truly "unset" before injecting it. However, that throws an exception.Not sure when this happened. Might have been when we switched to .NET 4.6.1, but could also be when we updated Autofac to version 4.
ASP .NET and Autofac packages in
packages.config
:The text was updated successfully, but these errors were encountered: