Ever Seen One of These? InvalidRepresentationException

While doing some custom FIM Activity development, I came across an exception that I had never seen before, so I thought I'd throw up a quick entry so I don't forget what it meant. 

It was the InvalidRepresentationException. Here is the stack trace:

Microsoft.ResourceManagement.WebServices.Exceptions.InvalidRepresentationException: Exception of type 'Microsoft.ResourceManagement.WebServices.Exceptions.InvalidRepresentationException' was thrown.
   at Microsoft.ResourceManagement.Utilities.ExceptionManager.ThrowException(Exception exception)
   at Microsoft.ResourceManagement.Data.Exception.DataAccessExceptionManager.ThrowException(SqlException innerException)
   at Microsoft.ResourceManagement.Data.DataAccess.ProcessRequest(RequestType request)
   at Microsoft.ResourceManagement.ActionProcessor.ActionDispatcher.ProcessInputRequest(RequestType request)
   at Microsoft.ResourceManagement.WebServices.RequestDispatcher.ExecuteAction(RequestType request)
   at Microsoft.ResourceManagement.WebServices.RequestDispatcher.ExecuteAction[ResponseBodyType](RequestType request)
   at Microsoft.ResourceManagement.WebServices.RequestDispatcher.DispatchRequest[ResponseBodyType](RequestType request, Guid requestIdentifier, Object redispatchSingleInstanceKey, Boolean isRedispatch)
   at Microsoft.ResourceManagement.WebServices.RequestDispatcher.DispatchRequest[ResponseBodyType](RequestType request)
   at Microsoft.ResourceManagement.Workflow.Hosting.RequestWorkItemProcessor.DispatchRequest[TResponseType](RequestType request)
   at Microsoft.ResourceManagement.Workflow.Hosting.RequestWorkItemProcessor.ProcessCreateWorkItem(CreateRequestWorkItem createWorkItem)
   at Microsoft.ResourceManagement.Workflow.Hosting.RequestWorkItemProcessor.ProcessWorkItem(WorkItem workItem)

Turns out that you will get this error whenever you attempt to write to an attribute that is:

  1. Invalid (e.g. mispelled, doesn't exist, etc.)
  2. Unbound/Not-bound to the type of object type you are referencing
  3. Missing a required attribute
  4. Basically of any other circumstance when you are referencing an attribute of an object that is violates its resource schema definition 

While in my situation, I came across it when negelected to include a CreateParameter for a required attribute, but I reckon you would also see this if you had a disconnect in an RCDC between what you are referencing and what is in the resource schema definition.

Anyway, if are reading this because you searched the web as I did and could find no other help, double check the spelling of the attributes you are referencing and their binds. I bet you'll find your problem there.