I am trying to set a private field with the Object State object but I keep getting a null reference exception. This is the code.
Operation activity = processFactory.CreateProcess("TestProcess");
ObjectState operationState = new ObjectState(activity);
operationState.SetField("_status", status);
Line 3 of the code is where the exception occurs. I have verified that there is a private field called "_status". I think this may be happening because the factory actually creates an object of type Process which is a sub type of Operation. I believe that you can not directly access the private fields of a parent class with reflection. I dont know the internals of how your are setting the field but what I have done in the past is just looped through the type's base classes until I found the specified field.
Or maybe this is another problem. Thanks for any help.