C# Data Security: PKCS7 Padding is invalid
I'm using the EncryptionTest.cs example on page 64 of the C# Data Security Handbook, which makes use of the Rijndael Managed security provider.
The example as written works fine, but I want to verify that decrypting with an invalid key produces non-intelligible plain text.
If I change the value of the exiting key (which was automatically generated) and then execute my code I get a CryptographicException of "PKCS7 padding is invalid and cannot be removed."
What is the reason for this and how can I get decrypted plain text to use in my applications without exceptions being thrown from invalid keys?