Posts Tagged ‘error’

SSRS error: Operation is not valid due to the current state of the object

Friday, February 10th, 2012

If you’re using SSRS in SharePoint integrated mode, you may come across this error when using report parameters that have a high number of items in them. A recent security bulletin highlighted some issues and vulnerabilities in ASP.net, and a patch was released to cover some of the items. One of these was the maximum number of items you can have in a collection. If you exceed the limit, then you’ll likely get an error like:

System.Web.HttpException:
The URL-encoded form data is not valid. —> System.InvalidOperationException: Operation is not valid due to the current state of the object.
at System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded()
at System.Web.HttpValueCollection.FillFromEncodedBytes(Byte[] bytes, Encoding encoding)
at System.Web.HttpRequest.FillInFormCollection()
— End of inner exception stack trace —
at System.Web.HttpRequest.FillInFormCollection()
at System.Web.HttpRequest.get_Form()

The workaround to this is to add the following to your web.config for your IIS application:

<appSettings>
<add key=”aspnet:MaxHttpCollectionKeys” value=”5000″ />
</appSettings>

where 5000 is a number big enough to cover the number of items in your collection. Be aware of the security implications this could have. There’s some really useful info around the issue, here.

Error occurred in deployment step ‘Activate Features’: Invalid field name.

Monday, September 12th, 2011

I posted about an issue I had been facing with deploying document sets via XML, where things like the custom welcome page and the shared fields (defined in XmlDocuments) wasn’t showing up.

Here’s a further issue I encountered. I defined my Document Set content type in the usual way. A bunch of Site Fields, then the Content Type definition, and then within the FieldRefs section some FieldRef elements for the fields to use.

At some point, I started to experience a strange error – when I was deploying the solution, I would get an error:

Error occurred in deployment step ‘Activate Features’: Invalid field name.

After a bit of research, things pointed to the fact that this error was caused by not declaring a Name attribute in the FieldRef. And adding a Name in to the FieldRef resolved the problem. However, I had another solution, doing the same thing, which would deploy successfully, but didn’t specify the Name attribute!

After some trial and error, I narrowed it down to the Overwrite attribute of the content type declaration. According to MSDN:

Optional Boolean. TRUE to overwrite an existing content type with the same ID.
The default is FALSE.

I’d set this to true, for obvious reasons. If you remove the attribute, then FieldRef with no Name attribute deploy successfully. And the existing content type is overwritten as well!

Yet another bug/feature/futureproof attribute (like Version, it seems) that displays inconsistent behaviour and can cause lots of issues! Well worth getting used to the ContentType and Field schemas, and I’d suggest using the bare minimum of attributes required.