I am not 100% on the rules, but I know there are restrictions on codeshares in the sense that it has to be used for through traffic.
However, whether FRA DEL on a YUL FRA DEL is no longer considered through traffic because of the stop over I am unsure of (but frankly I think this is incorrect).
IMHO, it would be an invalid use of codeshare flight / inventory if it was used to book an IROP or a flight on its own.