Mutating a value in the dictionary, in and of itself, will not cause this exception to be thrown. You must be either adding or removing a key pair for that exception to be thrown.
Even if you were mutating a key it wouldn't throw this exception, it would just (potentially) not function properly as it wouldn't be able to find items correctly.
Ideally if the function that you're calling is adding pairs to the dictionary it should instead return those key pairs from the method, and the caller can then store those values and add them after the end of the loop, rather than mutating the dictionary while you're enumerating it.