It runs fine with segwit addresses starting with a 1, but not native segwit.
Prefix 1 is used by legacy addresses. You can check the other prefixes used here: https://en.bitcoin.it/wiki/List_of_address_prefixes
Is there a way to use native segwit with Nbitcoin?
Replace BitcoinPubKeyAddress with BitcoinWitPubKeyAddress in your code for using native segwit ...