torsdag 21 april 2011

Load control template file /_controltemplates/TaxonomyPicker.ascx failed

Around the world people say that the solution is to replace , with a comma in the Inherits property in the Control tag. Tried it but it doesn't resolve the issue. Also some people are saying that the class actually doesn't exist anymore (at least not in any that namespace or assembly). Yes, that is the correct "solution". I just wright this to make sure that there are as many hits as possible pointing to the correct answer.

torsdag 7 april 2011

Disposing issues...

So many annoying things concerning disposing SPRequest based objects like SPWeb and SPSite. You can assume that objects like these should be disposed by SharePoint when they are given to you in properies in other objects, like SPListItem.Web, but no...

Examples I've found:

When you do a call to get an SPListItem from an SPItemEventProperties (typically in a receiver like properties.ListItem), if it's the first time you call for the list item, the get method opens up a new SPWeb object to get the list item based in the ListId and ListItemId properties and returns the list item. But the SPWeb object is never disposed. You have to manually dispose it from the list item.

When you call SPListItem.Attachments a similar situation occurs. the SPWeb object in the SPListItem.Web propery gets re-initialized and then you have to dispose it manually.

Pretty annoying ey?