I just got the same exception. Not sure if the cause is same with yours, but it went away after I changed the access modifiers of my class and its properties from internal to public.
internal
public