I was receiving an endlessly spinning ajax icon in the media section after upgrading to umbraco 4.9.1:
I pulled up fiddler, and noticed that I was getting an HTTP 500 error:
If i browsed to that URL directly, it uncovered a null reference exception in the umbraco.presentation.umbracobase.restExtension constructor:
[NullReferenceException: Object reference not set to an instance of an object.] umbraco.presentation.umbracobase.restExtension..ctor(String extensionAlias, String methodName) +1475 umbraco.presentation.umbracobase.requestModule.httpApp_PostAcquireRequestState(Object sender, EventArgs e) +2326 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +79 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +269
I ended up pulling down all the source, building the project in Visual Studio, and debugging my local website to track down the problem. What I found was that TypeFinder.FindClassesMarkedWithAttribute() was returning null items in the list, and that the code wasn't handling the nulls.
I was able to get past this by adding a simple 'skip the nulls' check in the code:
But i worry that there is some bigger underlying issue. I dug deeper and saw that when loading one of our custom DLLs, that umbraco.BusinessLogic.Utils.TypeFinder.FindClassesMarkedWithAttribute() was running into a problem loading some items from our DLL:
When it traps the exception and just returns ex.Types, there are items in the list that are null. So, my long setup comes to a point:
1) How do i track down what in our DLL isn't being loaded
2) Should a null check like I added be something that is included in a future patch?
I've had the same problem, so I've rolled back to v4.9 which fixed the problem, so it's definitely something to do with the 4.9.1 upgrade. Thank you source control!
Based on what i saw, the issue was dependent on what other DLLs were in the bin folder of website, which could explain why you are seeing the error on one website but not the other, and why some people have the issue and others don't.
In the code forTypeFinder.FindClassesMarkedWithAttribute(), if an exception is thrown when trying to filter the assembly types by attribute, then the function simply returns everything in the types array, which included some nulls. Then in the constructor for restExtension(string, string), it loops through the types and without checking for null tries to access t.GetCustomAttributes(), and this causes the error if 't' is null.
I found two ways to get around this:
By debugging and variable inspection, i was able to track down which of my DLLs was causing the exception, and it turned out that one of it's dependencies wasn't in my bin directory. When i brought over all required DLLs, then the exception went away.
I think the long term fix would be for FindClassesMarkedWithAttribute() to not return empty items in the list, or for the callers (such as restExtension and macro.GetXsltExtensionsImpl) to check for null before using the items in the list.
Umbraco 4.9.1: /base/FolderBrowserService/GetChildren/ returns http 500
I was receiving an endlessly spinning ajax icon in the media section after upgrading to umbraco 4.9.1:
I pulled up fiddler, and noticed that I was getting an HTTP 500 error:
If i browsed to that URL directly, it uncovered a null reference exception in the umbraco.presentation.umbracobase.restExtension constructor:
[NullReferenceException: Object reference not set to an instance of an object.]
umbraco.presentation.umbracobase.restExtension..ctor(String extensionAlias, String methodName) +1475
umbraco.presentation.umbracobase.requestModule.httpApp_PostAcquireRequestState(Object sender, EventArgs e) +2326
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +79
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +269
I ended up pulling down all the source, building the project in Visual Studio, and debugging my local website to track down the problem. What I found was that TypeFinder.FindClassesMarkedWithAttribute() was returning null items in the list, and that the code wasn't handling the nulls.
I was able to get past this by adding a simple 'skip the nulls' check in the code:
But i worry that there is some bigger underlying issue. I dug deeper and saw that when loading one of our custom DLLs, that umbraco.BusinessLogic.Utils.TypeFinder.FindClassesMarkedWithAttribute() was running into a problem loading some items from our DLL:
When it traps the exception and just returns ex.Types, there are items in the list that are null. So, my long setup comes to a point:
1) How do i track down what in our DLL isn't being loaded
2) Should a null check like I added be something that is included in a future patch?
I've had the same problem, so I've rolled back to v4.9 which fixed the problem, so it's definitely something to do with the 4.9.1 upgrade. Thank you source control!
I'm getting the same problem with 4.11 install. I don't have experience with 4.10.1 but cannot believe this is here from version 4.9.1?
I'm getting the same error on one website... Looks like a bug. But I have another site on 4.9.1 and not getting the error?
Having same experience with a fresh 4.11 upgrade
Based on what i saw, the issue was dependent on what other DLLs were in the bin folder of website, which could explain why you are seeing the error on one website but not the other, and why some people have the issue and others don't.
In the code forTypeFinder.FindClassesMarkedWithAttribute(), if an exception is thrown when trying to filter the assembly types by attribute, then the function simply returns everything in the types array, which included some nulls. Then in the constructor for restExtension(string, string), it loops through the types and without checking for null tries to access t.GetCustomAttributes(), and this causes the error if 't' is null.
I found two ways to get around this:
By debugging and variable inspection, i was able to track down which of my DLLs was causing the exception, and it turned out that one of it's dependencies wasn't in my bin directory. When i brought over all required DLLs, then the exception went away.
I think the long term fix would be for FindClassesMarkedWithAttribute() to not return empty items in the list, or for the callers (such as restExtension and macro.GetXsltExtensionsImpl) to check for null before using the items in the list.
is working on a reply...