Throw an exception when trying to resolve a temporary object in another context